PR other/25028
[official-gcc.git] / gcc / testsuite / gcc.dg / vla-6.c
blobb7bdb31eeca507d2ce8993421a727dfc87087833
1 /* { dg-options "-std=c99 -pedantic-errors" } */
3 int a[*]; /* { dg-error "not allowed in other than function prototype scope" } */
4 void foo1() { int a[*]; } /* { dg-error "not allowed in other than function prototype scope" } */
5 void foo2() { int a[*]; } /* { dg-error "not allowed in other than function prototype scope" } */
6 int foo3(int i)[*]; /* { dg-error "not allowed in other than function prototype scope" } */
7 void foo4(int o[*][4]) { } /* { dg-error "not allowed in other than function prototype scope" } */
8 void foo5(int o[4][*]) { } /* { dg-error "not allowed in other than function prototype scope" } */
10 /* [*] can't be used in a type that's not a declaration */
11 void foo11(int x[sizeof(int (*)[*])]); /* { dg-error "not allowed in other than a declaration" } */
12 void foo12(int [*]); /* { dg-error "not allowed in other than a declaration" } */
14 extern int n;
15 int B[100];
16 void foo10(int m) {
17 typedef int (*vla)[m];
18 struct tag {
19 vla x; /* { dg-error "a member of a structure or union cannot have a variably modified type" } */
20 /* PR c/7948 */
21 int (*y)[n]; /* { dg-error "a member of a structure or union cannot have a variably modified type" } */
22 int z[n]; /* { dg-error "a member of a structure or union cannot have a variably modified type" } */
24 /* PR c/25802 */
25 extern int (*r)[m]; /* { dg-error "variably modified type must have no linkage" } */