summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
blob: 5b432c769016c0a7bbefad87e61798c1a172e7c8 (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
// RUN: %clang_cc1 -emit-llvm -fexceptions -fcxx-exceptions -std=c++0x -o - %s | FileCheck %s

struct non_trivial {
  non_trivial();
  ~non_trivial();
};
non_trivial::non_trivial() {}
non_trivial::~non_trivial() {}

// We use a virtual base to ensure that the constructor
// delegation optimization (complete->base) can't be
// performed.
struct delegator {
  non_trivial n; 
  delegator();
  delegator(int);
  delegator(char);
  delegator(bool);
};

delegator::delegator() {
  throw 0;
}

// CHECK: define void @_ZN9delegatorC1Ei
// CHECK: call void @_ZN9delegatorC1Ev
// CHECK-NOT: lpad
// CHECK: ret
// CHECK-NOT: lpad
// CHECK: define void @_ZN9delegatorC2Ei
// CHECK: call void @_ZN9delegatorC2Ev
// CHECK-NOT: lpad
// CHECK: ret
// CHECK-NOT: lpad
delegator::delegator(int)
  : delegator()
{}

delegator::delegator(bool)
{}

// CHECK: define void @_ZN9delegatorC2Ec
// CHECK: call void @_ZN9delegatorC2Eb
// CHECK: call void @__cxa_throw
delegator::delegator(char)
  : delegator(true) {
  throw 0;
}
OpenPOWER on IntegriCloud