| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
| 2 |
|
| 3 |
// [class.base.init]p5 |
| 4 |
// 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 the |
| 6 |
// same member or for the same base class, the ctor-initializer is ill-formed. |
| 7 |
|
| 8 |
union 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 |
|
| 16 |
union 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 |
}; |