Possible Duplicate:
Can a string literal be subscripted in a constant expression?
If I subscript a string literal, is the result a compile-time constant? In other words, is the following code valid?
constexpr char x = "a"[0];
GCC 4.7 says it is, but what does the standard have to say on this matter?
For the curious: I can't just write 'a'
, because the string literal is the result of the stringizing operator. Some compilers do have a charizing operator, but it's only an extension.