g++4.0 diagnostic on casting a static const member initializer to a double

Mark Mitchell mark@codesourcery.com
Mon Jan 31 20:54:00 GMT 2005


Jonathan Wakely wrote:

> *but* this is allowed, even with -pedantic and -pedantic-errors:
> 
>   struct S
>   {
>     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'
>           ^^^^^^^

Yes, that's a bug -- independent of this static data member issue. 
We're apparently not being strict enough about integral constant 
expressions.  I'll look into that.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304



More information about the Gcc mailing list