PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / array-15.c
blob8e7c0adad2e0b47a04c012e03c1d289c0fe0e610
1 /* PR c/69262 */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -pedantic-errors" } */
5 struct S
7 int a[1][][2]; /* { dg-error "array type has incomplete element type" } */
8 /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
9 };
11 struct R
13 int i;
14 int a[][]; /* { dg-error "array type has incomplete element type" } */
15 /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
18 typedef int T[];
19 typedef int U[][]; /* { dg-error "array type has incomplete element type" } */
20 /* { dg-message "declaration of .U. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
22 int x[][]; /* { dg-error "array type has incomplete element type" } */
23 /* { dg-message "declaration of .x. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
25 struct N;
27 void
28 fn1 (int z[][]) /* { dg-error "array type has incomplete element type" } */
29 /* { dg-message "declaration of .z. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
31 int a[1][][2]; /* { dg-error "array type has incomplete element type" } */
32 /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
33 /* OK */
34 int b[3][2][1];
35 int c[1][2][3][]; /* { dg-error "array type has incomplete element type" } */
36 /* { dg-message "declaration of .c. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
37 T d[1]; /* { dg-error "array type has incomplete element type" } */
38 /* { dg-message "declaration of .d. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
39 T e[]; /* { dg-error "array type has incomplete element type" } */
40 /* { dg-message "declaration of .e. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
42 /* This array has incomplete element type, but is not multidimensional. */
43 struct N f[1]; /* { dg-error "array type has incomplete element type" } */
44 /* { dg-bogus "declaration of .f. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
47 void fn2 (int [][]); /* { dg-error "array type has incomplete element type" } */
48 /* { dg-message "declaration of multidimensional array must have bounds" "" { target *-*-* } .-1 } */
49 /* OK */
50 void fn3 (int [][*]);
51 void fn4 (T []); /* { dg-error "array type has incomplete element type" } */
52 /* { dg-message "declaration of multidimensional array must have bounds" "" { target *-*-* } .-1 } */