[C++0x] code that used to be accepted isn't accepted anymore (related to constexpr changes?)
Zdeněk Sojka
zsojka@seznam.cz
Sat Nov 6 00:15:00 GMT 2010
Hello,
the following code used to be accepted in 4.5.1, but isn't anymore in current trunk:
======= test.C =======
static const unsigned x = (unsigned)-1;
enum e {
ey = (int)x
};
struct A {
static const int y = (int)x;
};
===================
The error message is:
$ g++ -std=c++0x test.C
test.C:4:12: error: '-0x00000000000000001' is not a constant expression
test.C:4:12: error: enumerator value for 'ey' is not an integer constant
test.C:8:28: error: field initializer is not constant
Is this code going to be rejected in final 4.6.0, or is this just a temporal change?
Thanks in advance,
Zdenek Sojka
More information about the Gcc-help
mailing list