view 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
line wrap: on
line source

// { 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++2a } }
S d = { .a = 1, 2, 3 };		// { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++2a } }
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++2a } }
}
#endif