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