1// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - | FileCheck %s
2
3struct A {
4  A(); A(const A&); A(A&&); A &operator=(const A&); A &operator=(A&&); ~A();
5};
6struct B {
7  B(); B(const B&); B(B&&); B &operator=(const B&); B &operator=(B&&); ~B();
8};
9
10union U {
11  U();
12  U(const U &);
13  U(U &&);
14  U &operator=(const U&);
15  U &operator=(U&&);
16  ~U();
17
18  A a;
19  int n;
20};
21
22// CHECK-NOT: _ZN1A
23U::U() {}
24U::U(const U&) {}
25U::U(U&&) {}
26U &U::operator=(const U&) { return *this; }
27U &U::operator=(U &&) { return *this; }
28U::~U() {}
29
30struct S {
31  S();
32  S(const S &);
33  S(S &&);
34  S &operator=(const S&);
35  S &operator=(S&&);
36  ~S();
37
38  union {
39    A a;
40    int n;
41  };
42  B b;
43  int m;
44};
45
46// CHECK: _ZN1SC2Ev
47// CHECK-NOT: _ZN1A
48// CHECK: _ZN1BC1Ev
49S::S() {}
50
51// CHECK-NOT: _ZN1A
52
53// CHECK: _ZN1SC2ERKS_
54// CHECK-NOT: _ZN1A
55// CHECK: _ZN1BC1Ev
56S::S(const S&) {}
57
58// CHECK-NOT: _ZN1A
59
60// CHECK: _ZN1SC2EOS_
61// CHECK-NOT: _ZN1A
62// CHECK: _ZN1BC1Ev
63S::S(S&&) {}
64
65// CHECK-NOT: _ZN1A
66// CHECK-NOT: _ZN1B
67S &S::operator=(const S&) { return *this; }
68
69S &S::operator=(S &&) { return *this; }
70
71// CHECK: _ZN1SD2Ev
72// CHECK-NOT: _ZN1A
73// CHECK: _ZN1BD1Ev
74S::~S() {}
75
76// CHECK-NOT: _ZN1A
77