OSDN Git Service

2012-04-13 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / anon-struct-10.c
1 /* Test for designated initializers for anonymous structures and
2    unions.  PR 10676.  */
3 /* { dg-do run } */
4 /* { dg-options "" } */
5
6 extern void abort (void);
7 extern void exit (int);
8
9 struct s
10 {
11   int a;
12   struct
13   {
14     int b;
15     int c;
16   };
17   union
18   {
19     int d;
20     struct
21     {
22       int e;
23     };
24   };
25   struct
26   {
27     struct
28     {
29       struct
30       {
31         int f;
32       };
33     };
34   };
35 };
36
37 struct s x =
38   {
39     .e = 5,
40     .b = 4,
41     .a = 3,
42     .f = 7,
43     .c = 9
44   };
45
46 int
47 main (void)
48 {
49   if (x.a != 3
50       || x.b != 4
51       || x.c != 9
52       || x.d != 5
53       || x.e != 5
54       || x.f != 7)
55     abort ();
56   exit (0);
57 }