1 /* Test for C99 forms of array declarator. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
6 /* Because GCC doesn't yet implement it, we don't yet test for [*] here. */
8 /* Test each of: [quals], [quals expr], [static expr], [static quals expr],
9 [quals static expr]. Not yet: [quals *]. */
11 void f00 (int a
[const]);
12 void f01 (int [const]);
17 int **b
= &a
; /* { dg-bogus "warning" "warning in place of error" } */
18 /* { dg-error "discards" "discards quals" { target *-*-* } 17 } */
25 int **b
= &a
; /* { dg-bogus "warning" "warning in place of error" } */
26 /* { dg-error "discards" "discards quals" { target *-*-* } 25 } */
30 void f10 (int a
[const 2]);
31 void f11 (int [const 2]);
36 int **b
= &a
; /* { dg-bogus "warning" "warning in place of error" } */
37 /* { dg-error "discards" "discards quals" { target *-*-* } 36 } */
44 int **b
= &a
; /* { dg-bogus "warning" "warning in place of error" } */
45 /* { dg-error "discards" "discards quals" { target *-*-* } 44 } */
49 void f20 (int a
[static 2]);
50 void f21 (int [static 2]);
66 void f30 (int a
[static const 2]);
67 void f31 (int [static const 2]);
70 f32 (int a
[static const 2])
72 int **b
= &a
; /* { dg-bogus "warning" "warning in place of error" } */
73 /* { dg-error "discards" "discards quals" { target *-*-* } 72 } */
78 int a
[static const 2];
80 int **b
= &a
; /* { dg-bogus "warning" "warning in place of error" } */
81 /* { dg-error "discards" "discards quals" { target *-*-* } 80 } */
85 void f40 (int a
[const static 2]);
86 void f41 (int [const static 2]);
89 f42 (int a
[const static 2])
91 int **b
= &a
; /* { dg-bogus "warning" "warning in place of error" } */
92 /* { dg-error "discards" "discards quals" { target *-*-* } 91 } */
97 int a
[const static 2];
99 int **b
= &a
; /* { dg-bogus "warning" "warning in place of error" } */
100 /* { dg-error "discards" "discards quals" { target *-*-* } 99 } */
104 /* Test rejection of static and type qualifiers in non-parameter contexts. */
105 int x
[const 2]; /* { dg-bogus "warning" "warning in place of error" } */
106 /* { dg-error "non-parameter" "quals in non-parm array" { target *-*-* } 105 } */
107 int y
[static 2]; /* { dg-bogus "warning" "warning in place of error" } */
108 /* { dg-error "non-parameter" "static in non-parm array" { target *-*-* } 107 } */
109 void g (int a
[static 2][3]);
110 void h (int a
[2][static 3]); /* { dg-bogus "warning" "warning in place of error" } */
111 /* { dg-error "non-parameter" "static in non-final parm array" { target *-*-* } 110 } */