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[i];
    } x;
    return 0;
}

while

int main(void) {
    int i = 2;
    int a[i];
    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
_______________________________________________
Help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to