[C++0x] code that used to be accepted isn't accepted anymore (related to constexpr changes?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux