2013-10-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / c1x-anon-struct-1.c
blob6d4b433d733b22351cc5eaf797fd07d3ed23a714
1 /* Test for anonymous structures and unions in C1X. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c1x -pedantic-errors" } */
5 #include <stddef.h>
7 struct s1
9 int a;
10 union
12 int i;
14 struct
16 int b;
20 union u1
22 int b;
23 struct
25 int i;
27 union
29 int c;
33 struct s2
35 struct
37 int a;
41 struct s3
43 union
45 int i;
49 struct s4
51 struct
53 int i;
55 int a[];
58 struct s1 x =
60 .b = 1,
61 .i = 2,
62 .a = 3
65 int o = offsetof (struct s1, i);
67 void
68 f (void)
70 x.i = 3;
71 (&x)->i = 4;