Add new test to verify that the array index, limit, and stride are
[official-gcc.git] / gcc / testsuite / gcc.dg / Wdeclaration-after-statement-3.c
blobf001edf203efd6d179cec5b09906ee93af518797
1 /* PR 35058: -Werror= works only with some warnings. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c99 -pedantic -Werror=declaration-after-statement" } */
4 /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
5 extern void abort (void);
6 extern void exit (int);
8 int
9 main (void)
11 int i = 0;
12 if (i != 0)
13 abort ();
14 i++;
15 if (i != 1)
16 abort ();
17 int j = i; /* { dg-error "" "declaration-after-statement" } */
18 if (j != 1)
19 abort ();
20 struct foo { int i0; } k = { 4 }; /* { dg-error "" "declaration-after-statement" } */
21 if (k.i0 != 4)
22 abort ();
23 exit (0);