comparison gcc/testsuite/g++.dg/cpp2a/desig8.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // PR c++/84874
2 // { dg-do run { target c++17 } }
3 // { dg-options "" }
4
5 struct A { int a; struct { int b; }; };
6 struct B { A d; };
7
8 void
9 foo (B *x)
10 {
11 *x = { .d = { .b = 5 } };
12 }
13
14 void
15 bar (A *x)
16 {
17 *x = { .b = 6 };
18 }
19
20 int
21 main ()
22 {
23 B b = { { 2, 3 } };
24 foo (&b);
25 if (b.d.a != 0 || b.d.b != 5)
26 __builtin_abort ();
27 b.d.a = 8;
28 bar (&b.d);
29 if (b.d.a != 0 || b.d.b != 6)
30 __builtin_abort ();
31 }