27 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s2 3// [class.base.init]p54// A ctor-initializer may initialize a variant member of the constructor’s 5// class. If a ctor-initializer specifies more than one mem-initializer for the6// same member or for the same base class, the ctor-initializer is ill-formed.7 8union E {9 int a;10 int b;11 E() : a(1), // expected-note{{previous initialization is here}}12 b(2) { // expected-error{{initializing multiple members of union}}13 }14};15 16union F {17 struct {18 int a;19 int b;20 };21 int c;22 F() : a(1), // expected-note{{previous initialization is here}}23 b(2),24 c(3) { // expected-error{{initializing multiple members of union}}25 }26};27