1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuc struct Member { 4f4a2713aSLionel Sambuc ~Member(); 5f4a2713aSLionel Sambuc }; 6f4a2713aSLionel Sambuc 7f4a2713aSLionel Sambuc struct A { 8f4a2713aSLionel Sambuc virtual ~A(); 9f4a2713aSLionel Sambuc }; 10f4a2713aSLionel Sambuc 11f4a2713aSLionel Sambuc struct B : A { 12f4a2713aSLionel Sambuc Member m; 13f4a2713aSLionel Sambuc virtual ~B(); 14f4a2713aSLionel Sambuc }; 15f4a2713aSLionel Sambuc 16f4a2713aSLionel Sambuc // Complete dtor: just an alias because there are no virtual bases. 17f4a2713aSLionel Sambuc // CHECK: @_ZN1BD1Ev = alias {{.*}} @_ZN1BD2Ev 18f4a2713aSLionel Sambuc 19f4a2713aSLionel Sambuc // (aliases from C) 20f4a2713aSLionel Sambuc // CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev 21*0a6a1f1dSLionel Sambuc // CHECK: @_ZN1CD1Ev = alias {{.*}} @_ZN1CD2Ev 22f4a2713aSLionel Sambuc 23f4a2713aSLionel Sambuc // Base dtor: actually calls A's base dtor. 24f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr 25f4a2713aSLionel Sambuc // CHECK: call void @_ZN6MemberD1Ev 26f4a2713aSLionel Sambuc // CHECK: call void @_ZN1AD2Ev 27f4a2713aSLionel Sambuc 28*0a6a1f1dSLionel Sambuc // Deleting dtor: defers to the complete dtor. 29*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr 30*0a6a1f1dSLionel Sambuc // CHECK: call void @_ZN1BD1Ev 31*0a6a1f1dSLionel Sambuc // CHECK: call void @_ZdlPv 32*0a6a1f1dSLionel Sambuc ~B()33f4a2713aSLionel SambucB::~B() { } 34f4a2713aSLionel Sambuc 35f4a2713aSLionel Sambuc struct C : B { 36f4a2713aSLionel Sambuc ~C(); 37f4a2713aSLionel Sambuc }; 38f4a2713aSLionel Sambuc ~C()39f4a2713aSLionel SambucC::~C() { } 40f4a2713aSLionel Sambuc 41f4a2713aSLionel Sambuc // Complete dtor: just an alias (checked above). 42f4a2713aSLionel Sambuc 43f4a2713aSLionel Sambuc // Deleting dtor: defers to the complete dtor. 44f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_ZN1CD0Ev(%struct.C* %this) unnamed_addr 45f4a2713aSLionel Sambuc // CHECK: call void @_ZN1CD1Ev 46f4a2713aSLionel Sambuc // CHECK: call void @_ZdlPv 47f4a2713aSLionel Sambuc 48f4a2713aSLionel Sambuc // Base dtor: just an alias to B's base dtor. 49f4a2713aSLionel Sambuc 50f4a2713aSLionel Sambuc namespace PR12798 { 51f4a2713aSLionel Sambuc // A qualified call to a base class destructor should not undergo virtual 52f4a2713aSLionel Sambuc // dispatch. Template instantiation used to lose the qualifier. 53f4a2713aSLionel Sambuc struct A { virtual ~A(); }; f(T * p)54f4a2713aSLionel Sambuc template<typename T> void f(T *p) { p->A::~A(); } 55f4a2713aSLionel Sambuc 56f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN7PR127981fINS_1AEEEvPT_( 57f4a2713aSLionel Sambuc // CHECK: call void @_ZN7PR127981AD1Ev( 58f4a2713aSLionel Sambuc template void f(A*); 59f4a2713aSLionel Sambuc } 60