PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / c11-anon-struct-1.c
blob779ae66b7e1c743ca8381be37acc320b7d76dd93
1 /* Test for anonymous structures and unions in C11. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -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;