struct X {
constexpr static char a1[] = "hello"; // Okay
constexpr static const char* a2[] = {"hello"}; // Error
};
int main(){}
Compiling with gcc gives the error:
error: a brace-enclosed initializer is not allowed here before '{' token
Is this an illegal use of constexpr?
EDIT
I tried 3 different versions of gcc, and it compiled on the newest 4.7.0 I have (I just downloaded it, I'm using mingw-w64), so it looks to be a fixed bug (a link to the bug would be nice though!).
4.7.0 20120311 (prerelease) // Okay
4.6.4 20120305 (prerelease) // Error
4.7.0 20110829 (experimental) // Error
This is a bug which has been fixed. I have confirmed that the code compiles with g++ 4.7.0 20120311 (prerelease)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With