Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / special / class.init / class.base.init / p8-0x.cpp
blob45755caa8ecb2231dd77a569ef24403168393004
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
3 int n;
4 struct S {
5 int &a; // expected-note 2{{here}}
6 int &b = n;
8 union {
9 const int k = 42;
12 S() {} // expected-error {{constructor for 'S' must explicitly initialize the reference member 'a'}}
13 S(int) : a(n) {} // ok
14 S(char) : b(n) {} // expected-error {{constructor for 'S' must explicitly initialize the reference member 'a'}}
15 S(double) : a(n), b(n) {} // ok
16 } s(0);
18 union U {
19 int a = 0; // expected-note {{previous initialization}}
20 char b = 'x'; // expected-error {{initializing multiple members of union}}
22 U() {}
23 U(int) : a(1) {}
24 U(char) : b('y') {}
25 U(double) : a(1), // expected-note{{previous initialization is here}}
26 b('y') {} // expected-error{{initializing multiple members of union}}
29 // PR10954: variant members do not acquire an implicit initializer.
30 namespace VariantMembers {
31 struct NoDefaultCtor {
32 NoDefaultCtor(int);
34 union V {
35 NoDefaultCtor ndc;
36 int n;
38 V() {}
39 V(int n) : n(n) {}
40 V(int n, bool) : ndc(n) {}
42 struct K {
43 union {
44 NoDefaultCtor ndc;
45 int n;
47 K() {}
48 K(int n) : n(n) {}
49 K(int n, bool) : ndc(n) {}
51 struct Nested {
52 Nested() {}
53 union {
54 struct {
55 NoDefaultCtor ndc;