summaryrefslogtreecommitdiffstats
path: root/test/CXX/special/class.dtor/p3-0x.cpp
blob: c2d2496beb63b8f71c97c16f44380a77936fbc72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s

struct A {
  ~A();
};

struct B {
  ~B() throw(int);
};

struct C {
  B b;
  ~C() {}
};

struct D {
  ~D() noexcept(false);
};

struct E {
  D d;
  ~E() {}
};

void foo() {
  A a;
  C c;
  E e;
  // CHECK: invoke void @_ZN1ED1Ev
  // CHECK: invoke void @_ZN1CD1Ev
  // CHECK: call void @_ZN1AD1Ev
}

struct F {
  D d;
  ~F();
};
F::~F() noexcept(false) {}

struct G {
  D d;
  ~G();
};
G::~G() {}

struct H {
  B b;
  ~H();
};
H::~H() throw(int) {}

struct I {
  B b;
  ~I();
};
I::~I() {}

// Template variants.

template <typename T>
struct TA {
  ~TA();
};

template <typename T>
struct TB {
  ~TB() throw(int);
};

template <typename T>
struct TC {
  TB<T> b;
  ~TC() {}
};

template <typename T>
struct TD {
  ~TD() noexcept(false);
};

template <typename T>
struct TE {
  TD<T> d;
  ~TE() {}
};

void tfoo() {
  TA<int> a;
  TC<int> c;
  TE<int> e;
  // CHECK: invoke void @_ZN2TEIiED1Ev
  // CHECK: invoke void @_ZN2TCIiED1Ev
  // CHECK: call void @_ZN2TAIiED1Ev
}

template <typename T>
struct TF {
  TD<T> d;
  ~TF();
};
template <typename T>
TF<T>::~TF() noexcept(false) {}

template <typename T>
struct TG {
  TD<T> d;
  ~TG();
};
template <typename T>
TG<T>::~TG() {}

template <typename T>
struct TH {
  TB<T> b;
  ~TH();
};
template <typename T>
TH<T>::~TH() {}

void tinst() {
  TF<int> f;
  TG<int> g;
  TH<int> h;
}
// CHECK: define linkonce_odr void @_ZN2THIiED1Ev
// CHECK: _ZTIi
// CHECK: __cxa_call_unexpected

struct VX
{ virtual ~VX() {} };

struct VY : VX
{ virtual ~VY() {} };


struct VA {
  B b;
  virtual ~VA() {}
};

struct VB : VA
{ virtual ~VB() {} };