This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
g++4.0 diagnostic on casting a static const member initializer to a double
- From: Fariborz Jahanian <fjahanian at apple dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 31 Jan 2005 09:34:14 -0800
- Subject: g++4.0 diagnostic on casting a static const member initializer to a double
g++ 4.0 in FSF issues a diagnostic on the following test case:
template <class T> struct S {
static const double scd = (double)24;
};
test1.C:2: error: a cast to a type other than an integral or
enumeration type cannot appear in a constant-expression
Rewriting the above to:
template <class T> struct S {
static const double scd;
};
template <class T>
const double S<T>::scd = (double)24;
Compiles. Event though the diagnostic is clear in what it is saying,
but it seems to be a g++ bug
one way or the other.
- fariborz (fjahanian@apple.com).