C++ Primer says that
Array dimension must be known at compile time, which means that the dimension must be a constant expression
A separate point is made that
unsigned count = 42; // not a constant expression
constexpr unsigned size = 42; // a constant expression
I would, then expect for the following declaration to fail
a[count]; // Is an error according to Primer
And yet, it does not. Compiles and runs fine.
What is also kind of strange is that ++count;
subsequent to array declaration also causes no issues.
Program compiled with -std=c++11
flag on g++4.71
Why is that?