blob: 574d0b3133dc06e94c8d5b704fe970d9c48c062b [file] [log] [blame]
// { 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" }