I am trying to understand an example taken from the C++ Primer Book regarding array initialization. They say that
The number of elements in an array is part of the array’s type. As a result, the dimension must be known at compile time, which means that the dimension must be a constant expression
An example follows which is supposed to result in an error:
unsigned cnt = 42; // not a constant expression
string bad[cnt]; // error: cnt is not a constant expression
However, compiling this with g++ 4.8.4 does not result in an error.
Is this an error or outdated information in the book, or is it just a g++ feature?