[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-arraydecl-1.c
blob05bda39885e95a0874c4ad505c764da6b046c112
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]);
14 void
15 f02 (int a[const])
17 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
18 /* { dg-error "discards" "discards quals" { target *-*-* } .-1 } */
19 int *const *c = &a;
21 void
22 f03 (a)
23 int a[const];
25 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
26 /* { dg-error "discards" "discards quals" { target *-*-* } .-1 } */
27 int *const *c = &a;
30 void f10 (int a[const 2]);
31 void f11 (int [const 2]);
33 void
34 f12 (int a[const 2])
36 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
37 /* { dg-error "discards" "discards quals" { target *-*-* } .-1 } */
38 int *const *c = &a;
40 void
41 f13 (a)
42 int a[const 2];
44 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
45 /* { dg-error "discards" "discards quals" { target *-*-* } .-1 } */
46 int *const *c = &a;
49 void f20 (int a[static 2]);
50 void f21 (int [static 2]);
52 void
53 f22 (int a[static 2])
55 int **b = &a;
56 int *const *c = &a;
58 void
59 f23 (a)
60 int a[static 2];
62 int **b = &a;
63 int *const *c = &a;
66 void f30 (int a[static const 2]);
67 void f31 (int [static const 2]);
69 void
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 *-*-* } .-1 } */
74 int *const *c = &a;
76 void
77 f33 (a)
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 *-*-* } .-1 } */
82 int *const *c = &a;
85 void f40 (int a[const static 2]);
86 void f41 (int [const static 2]);
88 void
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 *-*-* } .-1 } */
93 int *const *c = &a;
95 void
96 f43 (a)
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 *-*-* } .-1 } */
101 int *const *c = &a;
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 *-*-* } .-1 } */
107 int y[static 2]; /* { dg-bogus "warning" "warning in place of error" } */
108 /* { dg-error "non-parameter" "static in non-parm array" { target *-*-* } .-1 } */
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 *-*-* } .-1 } */