1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -fno-rtti -mconstructor-aliases -O1 -disable-llvm-passes | FileCheck %s
2 
3 namespace test1 {
4 template <typename T> class A {
~A()5   ~A() {}
6 };
7 template class A<char>;
8 // CHECK-DAG: define weak_odr dso_local x86_thiscallcc void @"??1?$A@D@test1@@AAE@XZ"
9 }
10 
11 namespace test2 {
12 struct A {
13   virtual ~A();
14 };
15 struct B : A {
16   B();
17   virtual ~B();
18 };
19 
~A()20 A::~A() {}
~B()21 B::~B() {}
foo()22 void foo() {
23   B b;
24 }
25 // CHECK-DAG: @"??1B@test2@@UAE@XZ" = dso_local unnamed_addr alias void (%"struct.test2::B"*), bitcast (void (%"struct.test2::A"*)* @"??1A@test2@@UAE@XZ" to void (%"struct.test2::B"*)*)
26 }
27 
28 namespace test3 {
29 struct A { virtual ~A(); };
~A()30 A::~A() {}
31 }
32 // CHECK-DAG: define dso_local x86_thiscallcc void @"??1A@test3@@UAE@XZ"(
33 namespace test3 {
34 template <typename T>
35 struct B : A {
~Btest3::B36   virtual ~B() { }
37 };
38 template struct B<int>;
39 }
40 // This has to be weak, and emitting weak aliases is fragile, so we don't do the
41 // aliasing.
42 // CHECK-DAG: define weak_odr dso_local x86_thiscallcc void @"??1?$B@H@test3@@UAE@XZ"(
43