C
Christof Warlich
Hi,
the following compiles with gcc 2.95.3 but gives this error
with gcc 3.4.4:
~/tmp> gcc tst.cc
tst.c: In function `int main()':
tst.c:4: error: data member may not have variably modified type
`int[((unsignedint)((int)i))]'
int main(void) {
int i = 2;
struct X {
int a;
} x;
return 0;
}
while
int main(void) {
int i = 2;
int a;
return 0;
}
comiles with both gcc versions.
Any ideas why the newer gcc version only allows to create a dynamic
array, but not a dynamic type on the stack? Even more confusing,
both examples compile fine even with gcc 3.4.4 as C-module, i.e.
gcc tst.c
Christof
the following compiles with gcc 2.95.3 but gives this error
with gcc 3.4.4:
~/tmp> gcc tst.cc
tst.c: In function `int main()':
tst.c:4: error: data member may not have variably modified type
`int[((unsignedint)((int)i))]'
int main(void) {
int i = 2;
struct X {
int a;
} x;
return 0;
}
while
int main(void) {
int i = 2;
int a;
return 0;
}
comiles with both gcc versions.
Any ideas why the newer gcc version only allows to create a dynamic
array, but not a dynamic type on the stack? Even more confusing,
both examples compile fine even with gcc 3.4.4 as C-module, i.e.
gcc tst.c
Christof