This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++4.0 diagnostic on casting a static const member initializerto a double
Jonathan Wakely wrote:
There seems to be a (possibly undocumented) GCC extension involved here.
Yes, I think that extension is undocumented, but intentional. (That is
of course a bug in the documentation.) The extension pre-dates my
involvement with G++, IIRC.
That explains the diagnostic, too: it talks about the intializer
because, from a GNU-C++ point-of-view, the data member declaration
itself is OK.
And, yes, it's odd to allow initialized static data members of type
"double", but forbid initializers that are non-integers. The right
solution here is probably to eliminate the extension allowing in-class
initialization of static data members of floating-point types. Allowing
initializers that are not integeral constant-expressions leads to a
whole 'nother can of worms.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304