blob: c993134fea0d4ccc4e5b3101368891a4214e75f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// { dg-do compile }
// { dg-options "" }
struct S { int a, b, c; };
S a = { 1, 2, 3 };
S b = { .a = 1, .b = 2, .c = 3 };
S c = { 1, .b = 2, .c = 3 }; // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++20 } }
S d = { .a = 1, 2, 3 }; // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++20 } }
S e = { .b = 1, .b = 2 }; // { dg-error "designator used multiple times in the same initializer list" }
#if __cplusplus > 201103L
template <int... N>
void
foo ()
{
S f = { .a = N... }; // { dg-error "'...' not allowed in designated initializer list" "" { target c++20 } }
}
#endif
|