http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11393

--- Comment #20 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 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=c++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 = 3;
                    ^   ~
test.cc:4:23: warning: implicit conversion from 'double' to 'int' changes value
from 3.1415926 to 3 [-Wliteral-conversion]
 static const int c = 3.1415926;
                  ~   ^~~~~~~~~
2 warnings generated.
manuel@gcc10:~$ ~/bin/clang++ -std=c++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 = 3;
                    ^   ~
test.cc:3:21: note: use 'constexpr' specifier to silence this warning
 static const float b = 3;
                    ^
 constexpr 
test.cc:4:23: warning: implicit conversion from 'double' to 'int' changes value
from 3.1415926 to 3 [-Wliteral-conversion]
 static const int c = 3.1415926;
                  ~   ^~~~~~~~~
2 warnings generated.

To be honest, I like infinitely more the behaviour of clang.

Reply via email to