I asked this question before. But now I am wondering why the following is also valid or invalid:
class C {
int n;
int a[n];
};
template <typename T, int n> class A {
int a[n];
};
I tested them in g++ and they seemed to work. Are they the same as VLA in the case when inside a function, or they are different? Besides, I can now make the array parts on heap besides on stack too.