Debian Codegraph @

clang/test/CodeGenCXX/cxx11-unrestricted-union.cpp

raw
1 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -emit-llvm %s -o - | FileCheck %s
2
3 struct A {
4 A(); A(const A&); A(A&&); A &operator=(const A&); A &operator=(A&&); ~A();
5 };
6 struct B {
7 B(); B(const B&); B(B&&); B &operator=(const B&); B &operator=(B&&); ~B();
8 };
9
10 union 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
23 U::U() {}
24 U::U(const U&) {}
25 U::U(U&&) {}
26 U &U::operator=(const U&) { return *this; }
27 U &U::operator=(U &&) { return *this; }
28 U::~U() {}
29
30 struct 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
49 S::S() {}
50
51 // CHECK-NOT: _ZN1A
52
53 // CHECK: _ZN1SC2ERKS_
54 // CHECK-NOT: _ZN1A
55 // CHECK: _ZN1BC1Ev
56 S::S(const S&) {}
57
58 // CHECK-NOT: _ZN1A
59
60 // CHECK: _ZN1SC2EOS_
61 // CHECK-NOT: _ZN1A
62 // CHECK: _ZN1BC1Ev
63 S::S(S&&) {}
64
65 // CHECK-NOT: _ZN1A
66 // CHECK-NOT: _ZN1B
67 S &S::operator=(const S&) { return *this; }
68
69 S &S::operator=(S &&) { return *this; }
70
71 // CHECK: _ZN1SD2Ev
72 // CHECK-NOT: _ZN1A
73 // CHECK: _ZN1BD1Ev
74 S::~S() {}
75
76 // CHECK-NOT: _ZN1A