comparison gcc/testsuite/gcc.dg/vla-6.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-options "-std=c99 -pedantic-errors" } */
2
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" } */
9
10 /* [*] can't be used in a type that's not a declaration (maybe, the
11 final wording for DR#341 would allow it although the first
12 discussed intent would not). */
13 void foo11(int x[sizeof(int (*)[*])]); /* { dg-warning "not in a declaration" } */
14 /* This case is allowed per DR#341. */
15 void foo12(int [*]);
16
17 extern int n;
18 int B[100];
19 void foo10(int m) {
20 typedef int (*vla)[m];
21 struct tag {
22 vla x; /* { dg-error "a member of a structure or union cannot have a variably modified type" } */
23 /* PR c/7948 */
24 int (*y)[n]; /* { dg-error "a member of a structure or union cannot have a variably modified type" } */
25 int z[n]; /* { dg-error "a member of a structure or union cannot have a variably modified type" } */
26 };
27 /* PR c/25802 */
28 extern int (*r)[m]; /* { dg-error "variably modified type must have no linkage" } */
29 }