1 // PR c++/54922
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-pedantic" }
4 
5 #define SA(X) static_assert(X,#X)
6 
7 struct A
8 {
9   union {
10     union {
11       union {
12 	unsigned char i;
13 	int j;
14       };
15     };
16   };
17 
AA18   constexpr A() : i(42) {}
19 };
20 
21 constexpr A a;
22 SA((a.i == 42));
23 
24 struct B
25 {
26   struct {		        // { dg-warning "10:ISO C\\+\\+ prohibits anonymous struct" }
27     int h;
28     struct {			// { dg-warning "12:ISO C\\+\\+ prohibits anonymous struct" }
29       union {
30 	unsigned char i;
31 	int j;
32       };
33       int k;
34     };
35   };
36   int l;
37 
BB38   constexpr B(): h(1), i(2), k(3), l(4) {}
39 };
40 
41 constexpr B b;
42 SA((b.h == 1 && b.i == 2 && b.k == 3 && b.l == 4));
43