[Bug c++/11393] Initializer of static const float class member is not legal in c++98

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Oct 26 02:13:00 GMT 2012


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

--- Comment #28 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-26 02:13:23 UTC ---
(In reply to comment #27)
> And for similar reasons, it seems wrong to reject "b" with a permerror: The
> code is accepted in c++98 as an extension, so it could be equally accepted in
> c++11 as an extension, and warned by -pedantic. No need to force users to use
> constexpr

Why not?

C++11 offers a portable alternative, there is no reason to use a deprecated
extension when you can use constexpr.  It's an extension in C++98 because there
is no other way to write the code.  Supporting the extension in C++11 is wrong,
the portable, standard feature should be used instead.

> Again, this is what clang does, which makes perfect sense to me.

I guess clang supports it for GCC compatibility, not because it's a good idea
that we should copy.

> So, I still see two bugs.

Your "c" example seems like a completely separate issue that should be a
separate PR, I don't understand why it's being discussed here.



More information about the Gcc-bugs mailing list