]>
Commit | Line | Data |
---|---|---|
00083992 MP |
1 | /* PR c/69262 */ |
2 | /* { dg-do compile } */ | |
3 | /* { dg-options "-std=c11 -pedantic-errors" } */ | |
4 | ||
5 | struct S | |
6 | { | |
7 | int a[1][][2]; /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 8 | /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
9 | }; |
10 | ||
11 | struct R | |
12 | { | |
13 | int i; | |
14 | int a[][]; /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 15 | /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
16 | }; |
17 | ||
18 | typedef int T[]; | |
19 | typedef int U[][]; /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 20 | /* { dg-message "declaration of .U. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
21 | |
22 | int x[][]; /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 23 | /* { dg-message "declaration of .x. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
24 | |
25 | struct N; | |
26 | ||
27 | void | |
28 | fn1 (int z[][]) /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 29 | /* { dg-message "declaration of .z. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
30 | { |
31 | int a[1][][2]; /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 32 | /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
33 | /* OK */ |
34 | int b[3][2][1]; | |
35 | int c[1][2][3][]; /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 36 | /* { dg-message "declaration of .c. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 | 37 | T d[1]; /* { dg-error "array type has incomplete element type" } */ |
6143c998 | 38 | /* { dg-message "declaration of .d. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 | 39 | T e[]; /* { dg-error "array type has incomplete element type" } */ |
6143c998 | 40 | /* { dg-message "declaration of .e. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
41 | |
42 | /* This array has incomplete element type, but is not multidimensional. */ | |
43 | struct N f[1]; /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 44 | /* { dg-bogus "declaration of .f. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
45 | } |
46 | ||
47 | void fn2 (int [][]); /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 48 | /* { dg-message "declaration of multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |
00083992 MP |
49 | /* OK */ |
50 | void fn3 (int [][*]); | |
51 | void fn4 (T []); /* { dg-error "array type has incomplete element type" } */ | |
6143c998 | 52 | /* { dg-message "declaration of multidimensional array must have bounds" "" { target *-*-* } .-1 } */ |