While investigating the constexpr keyword in C++, I've come up with the following code:
#include <iostream>
int main() {
const int n = 10;
constexpr int n2 = 10;
int a1[n];
int a2[n2];
std::cout << "n " << n << std::endl;
std::cout << "n2 " << n2 << std::endl;
}
I would expect that declaring the array a1 with "const" would not work and the compiler would at least give me a warning (assuming the compilation is done with g++ -Wall -pedantic constexpr_1.cpp -o ce1) but it does not. I've seen some error with VS compiler so any hint is welcome here.