Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/desig13.C

raw
1 // PR c++/71446
2 // { dg-do compile { target c++11 } }
3 // { dg-options "" }
4
5 struct S { int a, b, c, d, e; };
6 struct T { int a, b; };
7 void foo (S);
8 void bar (T);
9
10 void
11 baz ()
12 {
13 foo ({.d = 5, 6, .b = 2, 3}); // { dg-error "designator order for field 'S::b' does not match declaration order in 'S'" }
14 // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++20 } .-1 }
15 bar ({.b = 1, .a = 2}); // { dg-error "designator order for field 'T::a' does not match declaration order in 'T'" }
16 }