[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / desig1.C
blobd6bc0681cc0d5182f8651d8bbaa8b1a9d6013eaa
1 // { dg-do compile }
2 // { dg-options "-pedantic" }
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 } }
12 int
13 main ()
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;