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

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Jan 31 20:06:00 GMT 2005


Matt Austern <austern@apple.com> writes:

[...]

| > The diagnostic could be better, but it is indeed accurate; if
| > there's an initializer it must be integral constant-expression, and
| > a cast to "double" cannot appear in such an expression.
| 
| Hm, I think it's stretching it a bit to call that diagnostic accurate.
| The real user error is trying to initialize a static const double in
| the first place, not the details of what we're trying to initialize it
| with.
| 
| You're right that this code is invalid, but I think your average user
| who gets this error message might be mystified about what's wrong.


100% agreed on both count.

-- Gaby



More information about the Gcc mailing list