http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11393
--- Comment #24 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-10-26
00:23:46 UTC ---
Interestingly,
manuel@gcc10:~$ ~/bin/clang++ -std=c++98 pr11393.cc -pedantic-errors
pr11393.cc:3:21: error: in-class initializer for static data member of type
'const float' is a GNU extension [-Werror,-Wgnu]
static const float b = 3;
^ ~
pr11393.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;
~ ^~~~~~~~~
pr11393.cc:4:23: error: in-class initializer for static data member is not a
constant expression; folding it to a constant is a GNU extension
[-Werror,-Wpedantic]
static const int c = 3.1415926;
^~~~~~~~~
pr11393.cc:5:21: error: in-class initializer for static data member of type
'const float' is a GNU extension [-Werror,-Wgnu]
static const float d = 3.1415926;
^ ~~~~~~~~~
1 warning and 3 errors generated.
So, in g++ parlance, "b" and "d" is a pedwarn enabled by default, while "c" is
a pedwarn in c++98 mode enabled by -Wpedantic and nothing in c++11 mode.