Merge reload-branch up to revision 101000
[official-gcc.git] / gcc / testsuite / gcc.dg / redecl-2.c
blobb1b7dc929debd49b057dd9d3ea7be437bf768c32
1 /* Test for multiple declarations of an identifier at same block
2 scope: only valid case is all extern. */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "" } */
7 void
8 fa0 (void)
10 int a0; /* { dg-error "previous declaration" } */
11 int a0; /* { dg-error "redeclaration" } */
14 void
15 fa1 (void)
17 int a1; /* { dg-error "previous declaration" } */
18 static int a1; /* { dg-error "redeclaration" } */
21 void
22 fa2 (void)
24 int a2; /* { dg-error "previous declaration" } */
25 extern int a2; /* { dg-error "follows declaration with no linkage" } */
28 void
29 fa3 (void)
31 static int a3; /* { dg-error "previous declaration" } */
32 int a3; /* { dg-error "redeclaration" } */
35 void
36 fa4 (void)
38 static int a4; /* { dg-error "previous declaration" } */
39 static int a4; /* { dg-error "redeclaration" } */
42 void
43 fa5 (void)
45 static int a5; /* { dg-error "previous declaration" } */
46 extern int a5; /* { dg-error "follows declaration with no linkage" } */
49 void
50 fa6 (void)
52 extern int a6; /* { dg-error "previous declaration" } */
53 int a6; /* { dg-error "follows extern declaration" } */
56 void
57 fa7 (void)
59 extern int a7; /* { dg-error "previous declaration" } */
60 static int a7; /* { dg-error "follows extern declaration" } */
63 void
64 fa8 (void)
66 extern int a8;
67 extern int a8;