From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14126 invoked by alias); 25 Oct 2012 23:44:27 -0000 Received: (qmail 13844 invoked by uid 48); 25 Oct 2012 23:44:05 -0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/11393] Initializer of static const float class member is not legal in c++98 Date: Thu, 25 Oct 2012 23:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg02397.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D11393 --- Comment #20 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 2012-10-25 23:44:01 UTC --- BTW, clang accepts "b" as a GNU extension, and it does not care at all about "c" (except for the -Wconversion warning that is enabled by default). manuel@gcc10:~$ ~/bin/clang++ -std=3Dc++98 test.cc test.cc:3:21: warning: in-class initializer for static data member of type 'const float' is a GNU extension [-Wgnu] static const float b =3D 3; ^ ~ test.cc:4:23: warning: implicit conversion from 'double' to 'int' changes v= alue from 3.1415926 to 3 [-Wliteral-conversion] static const int c =3D 3.1415926; ~ ^~~~~~~~~ 2 warnings generated. manuel@gcc10:~$ ~/bin/clang++ -std=3Dc++11 test.cc test.cc:3:21: warning: in-class initializer for static data member of type 'const float' is a GNU extension [-Wgnu] static const float b =3D 3; ^ ~ test.cc:3:21: note: use 'constexpr' specifier to silence this warning static const float b =3D 3; ^ constexpr=20 test.cc:4:23: warning: implicit conversion from 'double' to 'int' changes v= alue from 3.1415926 to 3 [-Wliteral-conversion] static const int c =3D 3.1415926; ~ ^~~~~~~~~ 2 warnings generated. To be honest, I like infinitely more the behaviour of clang.