2013-05-06 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / c1x-anon-struct-2.c
blobcb8043117d5d13c566838fc0fb5b9aa706e740a6
1 /* Test for anonymous structures and unions in C1X. Test for invalid
2 cases. */
3 /* { dg-do compile } */
4 /* { dg-options "-std=c1x -pedantic-errors" } */
6 typedef struct s0
8 int i;
9 } s0;
11 struct s1
13 int a;
14 struct s0; /* { dg-error "declaration does not declare anything" } */
17 struct s2
19 int a;
20 s0; /* { dg-error "declaration does not declare anything" } */
23 struct s3
25 struct
27 int i;
29 struct
31 int i; /* { dg-error "duplicate member" } */
35 struct s4
37 int a;
38 struct s
40 int i;
41 }; /* { dg-error "declaration does not declare anything" } */
44 struct s5
46 struct
48 int i;
49 } a;
50 int b;
51 } x;
53 void
54 f (void)
56 x.i = 0; /* { dg-error "has no member" } */