aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/desig5.C
blob: 574d0b3133dc06e94c8d5b704fe970d9c48c062b (plain)
1
2
3
4
5
6
7
8
9
10
11
// { dg-do compile }
// { dg-options "" }

union u { int a; const char* b; };
u a = { 1 };
u b = a;
u c = 1;			// { dg-error "conversion from 'int' to non-scalar type 'u' requested" }
u d = { 0, "asdf" };		// { dg-error "too many initializers for" }
u e = { "asdf" };		// { dg-error "invalid conversion from 'const char\\*' to 'int'" }
u f = { .b = "asdf" };
u g = { .a = 1, .b = "asdf" };	// { dg-error "too many initializers for" }