I tried to execute two different scenarios :
Scenario 1:
const auto arraySize = 10; // fine, arraySize is constant
std::array<int, arraySize> data;
Here , arraySize is treated as compile time constant and hence it was allowed in std::array .
Scenario 2:
int sz=10;
const auto arraySize = sz; // fine .
std::array<int, arraySize> data; //error , arraySize is not compile time constant .
In scenario 2 , arraySize is not treated as compile time constant despite of the fact that arrySize is a constant copy of sz .
Why these two scenarios were treated differently ?