Yes, but all modern linkers perform constant folding, merging these into one.
And as I said, one is a const expression, the other not. Observe:
Code:const int CON1 = 5; extern const int CON2; template <int I> class foo { }; int main() { int ar_yes[CON1]; int ar_no[CON2]; foo<CON1> t_yes; foo<CON2> t_no; }The -std and -pedantic arguments are necessary to disable GCC's VLA for C++ extension.Code:$ g++ -c -pedantic -std=c++98 src.cpp src.cpp: In function ‘int main()’: src.cpp:12: error: ISO C++ forbids variable-size array ‘ar_no’ src.cpp:15: error: ‘CON2’ is not a valid template argument for type ‘int’ because it is a non-constant expression src.cpp:15: error: invalid type in declaration before ‘;’ token


CornedBee
