comparison gcc/testsuite/g++.dg/cpp2a/desig1.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 // { dg-do compile }
2 // { dg-options "-pedantic" }
3
4 struct A { int a; };
5 struct B { int b; A c; int d; };
6 A a = { 1 };
7 A b = { .a = 2 }; // { dg-warning "designated initializers only available with" "" { target c++17_down } }
8 B c = { 3, { 4 }, 5 };
9 B d = { .b = 6, .c { 7 }, .d = 8 }; // { dg-warning "designated initializers only available with" "" { target c++17_down } }
10 B e = { .c = { .a = 9 } }; // { dg-warning "designated initializers only available with" "" { target c++17_down } }
11
12 int
13 main ()
14 {
15 if (a.a != 1 || b.a != 2
16 || c.b != 3 || c.c.a != 4 || c.d != 5
17 || d.b != 6 || d.c.a != 7 || d.d != 8
18 || e.b != 0 || e.c.a != 9 || e.d != 0)
19 __builtin_abort ();
20 return 0;
21 }