This is the mail archive of the
mailing list for the GCC project.
Re: g++4.0 diagnostic on casting a static const member initializer to a double
On Mon, Jan 31, 2005 at 10:38:22AM -0800, Mark Mitchell wrote:
> 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.
The diagnostic message was added when fixing c++/14550, but I don't
know if that was what changed the behaviour or if that had always been
> 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.
Yes. If you compile with -pedantic you get the diagnostic Matt was
*but* this is allowed, even with -pedantic and -pedantic-errors:
static const int scd = 24.2;
$ g++4x int.cc -c -pedantic -pedantic-errors -std=c++98
int.cc:3: warning: converting to 'int' from 'double'
A strict reading of the standard says that conversion shouldn't be
allowed, so surely it should be an error with -pedantic-errors ?
"A woman drove me to drink, I never had the courtesy to thank her."
- W.C. Fields