1// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -fno-rtti -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s
2
3namespace test1 {
4template <typename T> class A {
5  ~A() {}
6};
7template class A<char>;
8// CHECK-DAG: define weak_odr x86_thiscallcc void @"\01??1?$A@D@test1@@AAE@XZ"
9}
10
11namespace test2 {
12struct A {
13  virtual ~A();
14};
15struct B : A {
16  B();
17  virtual ~B();
18};
19
20A::~A() {}
21B::~B() {}
22void foo() {
23  B b;
24}
25// CHECK-DAG: @"\01??1B@test2@@UAE@XZ" = alias void (%"struct.test2::B"*), bitcast (void (%"struct.test2::A"*)* @"\01??1A@test2@@UAE@XZ" to void (%"struct.test2::B"*)*)
26}
27
28namespace test3 {
29struct A { virtual ~A(); };
30A::~A() {}
31}
32// CHECK-DAG: define x86_thiscallcc void @"\01??1A@test3@@UAE@XZ"(
33namespace test3 {
34template <typename T>
35struct B : A {
36  virtual ~B() { }
37};
38template 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 x86_thiscallcc void @"\01??1?$B@H@test3@@UAE@XZ"(
43