1 // RUN: %clang_cc1 -fms-extensions -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s 2 3 template<typename T> 4 class Class { 5 public: method()6 void method() {} 7 }; 8 9 class Typename { }; 10 11 template<typename T> 12 class Nested { }; 13 14 template<bool flag> 15 class BoolTemplate { 16 public: BoolTemplate()17 BoolTemplate() {} 18 }; 19 20 template<int param> 21 class IntTemplate { 22 public: IntTemplate()23 IntTemplate() {} 24 }; 25 26 template<> 27 class BoolTemplate<true> { 28 public: BoolTemplate()29 BoolTemplate() {} Foo(T arg)30 template<class T> void Foo(T arg) {} 31 }; 32 template_mangling()33void template_mangling() { 34 Class<Typename> c1; 35 c1.method(); 36 // CHECK: call {{.*}} @"\01?method@?$Class@VTypename@@@@QAEXXZ" 37 38 Class<Nested<Typename> > c2; 39 c2.method(); 40 // CHECK: call {{.*}} @"\01?method@?$Class@V?$Nested@VTypename@@@@@@QAEXXZ" 41 42 BoolTemplate<false> _false; 43 // CHECK: call {{.*}} @"\01??0?$BoolTemplate@$0A@@@QAE@XZ" 44 45 BoolTemplate<true> _true; 46 // PR13158 47 _true.Foo(1); 48 // CHECK: call {{.*}} @"\01??0?$BoolTemplate@$00@@QAE@XZ" 49 // CHECK: call {{.*}} @"\01??$Foo@H@?$BoolTemplate@$00@@QAEXH@Z" 50 51 IntTemplate<0> zero; 52 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0A@@@QAE@XZ" 53 54 IntTemplate<5> five; 55 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$04@@QAE@XZ" 56 57 IntTemplate<11> eleven; 58 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0L@@@QAE@XZ" 59 60 IntTemplate<256> _256; 61 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0BAA@@@QAE@XZ" 62 63 IntTemplate<513> _513; 64 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0CAB@@@QAE@XZ" 65 66 IntTemplate<1026> _1026; 67 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0EAC@@@QAE@XZ" 68 69 IntTemplate<65535> ffff; 70 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0PPPP@@@QAE@XZ" 71 } 72 73 namespace space { foo(const T & l)74 template<class T> const T& foo(const T& l) { return l; } 75 } 76 // CHECK: "\01??$foo@H@space@@YAABHABH@Z" 77 use()78void use() { 79 space::foo(42); 80 } 81