2018-09-09 04:58:39 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
|
2018-12-27 01:44:40 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
|
2021-01-20 06:37:10 +08:00
|
|
|
|
2012-05-27 07:12:19 +08:00
|
|
|
template<typename T>
|
|
|
|
class Class {
|
|
|
|
public:
|
2013-04-25 12:25:40 +08:00
|
|
|
Class() {}
|
2012-05-27 07:12:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Typename { };
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
class Nested { };
|
|
|
|
|
|
|
|
template<bool flag>
|
|
|
|
class BoolTemplate {
|
|
|
|
public:
|
|
|
|
BoolTemplate() {}
|
|
|
|
};
|
|
|
|
|
2012-05-28 08:43:56 +08:00
|
|
|
template<int param>
|
|
|
|
class IntTemplate {
|
|
|
|
public:
|
|
|
|
IntTemplate() {}
|
|
|
|
};
|
|
|
|
|
2014-12-11 13:47:10 +08:00
|
|
|
template<unsigned param>
|
|
|
|
class UnsignedIntTemplate {
|
|
|
|
public:
|
|
|
|
UnsignedIntTemplate() {}
|
|
|
|
};
|
|
|
|
|
2013-12-09 18:44:32 +08:00
|
|
|
template<long long param>
|
|
|
|
class LongLongTemplate {
|
|
|
|
public:
|
|
|
|
LongLongTemplate() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<unsigned long long param>
|
|
|
|
class UnsignedLongLongTemplate {
|
|
|
|
public:
|
|
|
|
UnsignedLongLongTemplate() {}
|
|
|
|
};
|
|
|
|
|
2012-06-23 08:27:49 +08:00
|
|
|
template<>
|
|
|
|
class BoolTemplate<true> {
|
|
|
|
public:
|
|
|
|
BoolTemplate() {}
|
|
|
|
template<class T> void Foo(T arg) {}
|
|
|
|
};
|
|
|
|
|
2012-05-27 07:12:19 +08:00
|
|
|
void template_mangling() {
|
|
|
|
Class<Typename> c1;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@VTypename@@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@VTypename@@@@QEAA@XZ"
|
2012-05-27 07:12:19 +08:00
|
|
|
|
2013-04-09 20:47:38 +08:00
|
|
|
Class<const Typename> c1_const;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@$$CBVTypename@@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@$$CBVTypename@@@@QEAA@XZ"
|
2013-04-09 20:47:38 +08:00
|
|
|
Class<volatile Typename> c1_volatile;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@$$CCVTypename@@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@$$CCVTypename@@@@QEAA@XZ"
|
2013-04-09 20:47:38 +08:00
|
|
|
Class<const volatile Typename> c1_cv;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@$$CDVTypename@@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@$$CDVTypename@@@@QEAA@XZ"
|
2013-04-09 20:47:38 +08:00
|
|
|
|
2012-05-27 07:12:19 +08:00
|
|
|
Class<Nested<Typename> > c2;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@V?$Nested@VTypename@@@@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@V?$Nested@VTypename@@@@@@QEAA@XZ"
|
2013-04-25 12:25:40 +08:00
|
|
|
|
|
|
|
Class<int * const> c_intpc;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@QAH@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@QEAH@@QEAA@XZ"
|
2013-04-25 12:25:40 +08:00
|
|
|
Class<int()> c_ft;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@$$A6AHXZ@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@$$A6AHXZ@@QEAA@XZ"
|
2013-04-25 12:25:40 +08:00
|
|
|
Class<int[]> c_inti;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@$$BY0A@H@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@$$BY0A@H@@QEAA@XZ"
|
2013-04-25 12:25:40 +08:00
|
|
|
Class<int[5]> c_int5;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@$$BY04H@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@$$BY04H@@QEAA@XZ"
|
2013-04-25 12:25:40 +08:00
|
|
|
Class<const int[5]> c_intc5;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@$$BY04$$CBH@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@$$BY04$$CBH@@QEAA@XZ"
|
2013-04-25 12:25:40 +08:00
|
|
|
Class<int * const[5]> c_intpc5;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$Class@$$BY04QAH@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$Class@$$BY04QEAH@@QEAA@XZ"
|
2012-05-27 07:12:19 +08:00
|
|
|
|
|
|
|
BoolTemplate<false> _false;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$BoolTemplate@$0A@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$BoolTemplate@$0A@@@QEAA@XZ"
|
2012-05-27 07:12:19 +08:00
|
|
|
|
|
|
|
BoolTemplate<true> _true;
|
2012-06-23 08:27:49 +08:00
|
|
|
// PR13158
|
|
|
|
_true.Foo(1);
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$BoolTemplate@$00@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$BoolTemplate@$00@@QEAA@XZ"
|
|
|
|
// CHECK: call {{.*}} @"??$Foo@H@?$BoolTemplate@$00@@QAEXH@Z"
|
|
|
|
// X64: call {{.*}} @"??$Foo@H@?$BoolTemplate@$00@@QEAAXH@Z"
|
2012-05-28 08:43:56 +08:00
|
|
|
|
2012-11-09 07:38:59 +08:00
|
|
|
IntTemplate<0> zero;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0A@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0A@@@QEAA@XZ"
|
2012-11-09 07:38:59 +08:00
|
|
|
|
2012-05-29 00:53:33 +08:00
|
|
|
IntTemplate<5> five;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$04@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$04@@QEAA@XZ"
|
2012-05-29 00:53:33 +08:00
|
|
|
|
2012-05-28 08:43:56 +08:00
|
|
|
IntTemplate<11> eleven;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0L@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0L@@@QEAA@XZ"
|
2012-05-28 08:43:56 +08:00
|
|
|
|
2012-10-03 21:39:49 +08:00
|
|
|
IntTemplate<256> _256;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0BAA@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0BAA@@@QEAA@XZ"
|
2012-10-03 21:39:49 +08:00
|
|
|
|
|
|
|
IntTemplate<513> _513;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0CAB@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0CAB@@@QEAA@XZ"
|
2012-10-03 21:39:49 +08:00
|
|
|
|
|
|
|
IntTemplate<1026> _1026;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0EAC@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0EAC@@@QEAA@XZ"
|
2012-10-03 21:39:49 +08:00
|
|
|
|
2012-05-28 08:43:56 +08:00
|
|
|
IntTemplate<65535> ffff;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0PPPP@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0PPPP@@@QEAA@XZ"
|
2013-12-09 18:44:32 +08:00
|
|
|
|
|
|
|
IntTemplate<-1> neg_1;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0?0@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0?0@@QEAA@XZ"
|
2013-12-09 18:44:32 +08:00
|
|
|
IntTemplate<-9> neg_9;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0?8@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0?8@@QEAA@XZ"
|
2013-12-09 18:44:32 +08:00
|
|
|
IntTemplate<-10> neg_10;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0?9@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0?9@@QEAA@XZ"
|
2013-12-09 18:44:32 +08:00
|
|
|
IntTemplate<-11> neg_11;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$IntTemplate@$0?L@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$IntTemplate@$0?L@@@QEAA@XZ"
|
2014-12-11 13:47:10 +08:00
|
|
|
|
|
|
|
UnsignedIntTemplate<4294967295> ffffffff;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QEAA@XZ"
|
2013-12-09 18:44:32 +08:00
|
|
|
|
|
|
|
LongLongTemplate<-9223372036854775807LL-1LL> int64_min;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QEAA@XZ"
|
2013-12-09 18:44:32 +08:00
|
|
|
LongLongTemplate<9223372036854775807LL> int64_max;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$LongLongTemplate@$0HPPPPPPPPPPPPPPP@@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$LongLongTemplate@$0HPPPPPPPPPPPPPPP@@@QEAA@XZ"
|
2013-12-09 18:44:32 +08:00
|
|
|
UnsignedLongLongTemplate<18446744073709551615ULL> uint64_max;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$UnsignedLongLongTemplate@$0?0@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$UnsignedLongLongTemplate@$0?0@@QEAA@XZ"
|
2013-12-09 18:44:32 +08:00
|
|
|
UnsignedLongLongTemplate<(unsigned long long)-1> uint64_neg_1;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$UnsignedLongLongTemplate@$0?0@@QAE@XZ"
|
|
|
|
// X64: call {{.*}} @"??0?$UnsignedLongLongTemplate@$0?0@@QEAA@XZ"
|
2012-05-27 07:12:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace space {
|
|
|
|
template<class T> const T& foo(const T& l) { return l; }
|
|
|
|
}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "??$foo@H@space@@YAABHABH@Z"
|
|
|
|
// X64: "??$foo@H@space@@YAAEBHAEBH@Z"
|
2012-05-27 07:12:19 +08:00
|
|
|
|
|
|
|
void use() {
|
|
|
|
space::foo(42);
|
|
|
|
}
|
2013-03-21 06:29:42 +08:00
|
|
|
|
|
|
|
// PR13455
|
|
|
|
typedef void (*FunctionPointer)(void);
|
|
|
|
|
|
|
|
template <FunctionPointer function>
|
|
|
|
void FunctionPointerTemplate() {
|
|
|
|
function();
|
|
|
|
}
|
|
|
|
|
|
|
|
void spam() {
|
|
|
|
FunctionPointerTemplate<spam>();
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "??$FunctionPointerTemplate@$1?spam@@YAXXZ@@YAXXZ"
|
|
|
|
// X64: "??$FunctionPointerTemplate@$1?spam@@YAXXZ@@YAXXZ"
|
2013-03-21 06:29:42 +08:00
|
|
|
}
|
2013-07-03 02:10:07 +08:00
|
|
|
|
|
|
|
// Unlike Itanium, there is no character code to indicate an argument pack.
|
|
|
|
// Tested with MSVC 2013, the first version which supports variadic templates.
|
|
|
|
|
2018-09-09 04:58:39 +08:00
|
|
|
template <typename ...Ts> void variadic_fn_template(const Ts &...args);
|
|
|
|
template <typename... Ts, typename... Us>
|
|
|
|
void multi_variadic_fn(Ts... ts, Us... us);
|
|
|
|
template <typename... Ts, typename C, typename... Us>
|
|
|
|
void multi_variadic_mixed(Ts... ts, C c, Us... us);
|
2013-07-03 02:10:07 +08:00
|
|
|
void variadic_fn_instantiate() {
|
|
|
|
variadic_fn_template(0, 1, 3, 4);
|
|
|
|
variadic_fn_template(0, 1, 'a', "b");
|
2018-09-09 04:58:39 +08:00
|
|
|
|
|
|
|
// Directlly consecutive packs are separated by $$Z...
|
|
|
|
multi_variadic_fn<int, int>(1, 2, 3, 4, 5);
|
|
|
|
multi_variadic_fn<int, int, int>(1, 2, 3, 4, 5);
|
|
|
|
|
|
|
|
// ...but not if another template parameter is between them.
|
|
|
|
multi_variadic_mixed<int, int>(1, 2, 3);
|
|
|
|
multi_variadic_mixed<int, int>(1, 2, 3, 4);
|
2013-07-03 02:10:07 +08:00
|
|
|
}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "??$variadic_fn_template@HHHH@@YAXABH000@Z"
|
2018-09-09 04:58:39 +08:00
|
|
|
// X64: "??$variadic_fn_template@HHHH@@YAXAEBH000@Z"
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "??$variadic_fn_template@HHD$$BY01D@@YAXABH0ABDAAY01$$CBD@Z"
|
2018-09-09 04:58:39 +08:00
|
|
|
// X64: "??$variadic_fn_template@HHD$$BY01D@@YAXAEBH0AEBDAEAY01$$CBD@Z"
|
|
|
|
// CHECK: "??$multi_variadic_fn@HH$$ZHHH@@YAXHHHHH@Z"
|
|
|
|
// X64: "??$multi_variadic_fn@HH$$ZHHH@@YAXHHHHH@Z"
|
|
|
|
// CHECK: "??$multi_variadic_fn@HHH$$ZHH@@YAXHHHHH@Z"
|
|
|
|
// X64: "??$multi_variadic_fn@HHH$$ZHH@@YAXHHHHH@Z"
|
|
|
|
// CHECK: "??$multi_variadic_mixed@HHH$$V@@YAXHHH@Z"
|
|
|
|
// X64: "??$multi_variadic_mixed@HHH$$V@@YAXHHH@Z"
|
|
|
|
// CHECK: "??$multi_variadic_mixed@HHHH@@YAXHHHH@Z"
|
|
|
|
// X64: "??$multi_variadic_mixed@HHHH@@YAXHHHH@Z"
|
2013-07-03 02:10:07 +08:00
|
|
|
|
|
|
|
template <typename ...Ts>
|
|
|
|
struct VariadicClass {
|
|
|
|
VariadicClass() { }
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
void variadic_class_instantiate() {
|
|
|
|
VariadicClass<int, char, bool> a;
|
|
|
|
VariadicClass<bool, char, int> b;
|
|
|
|
}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"??0?$VariadicClass@HD_N@@QAE@XZ"
|
|
|
|
// CHECK: call {{.*}} @"??0?$VariadicClass@_NDH@@QAE@XZ"
|
2013-08-06 05:33:59 +08:00
|
|
|
|
2013-08-06 06:26:46 +08:00
|
|
|
template <typename T>
|
|
|
|
struct Second {};
|
|
|
|
|
|
|
|
template <typename T, template <class> class>
|
|
|
|
struct Type {};
|
|
|
|
|
|
|
|
template <template <class> class T>
|
|
|
|
struct Type2 {};
|
|
|
|
|
|
|
|
template <template <class> class T, bool B>
|
|
|
|
struct Thing;
|
|
|
|
|
|
|
|
template <template <class> class T>
|
|
|
|
struct Thing<T, false> { };
|
|
|
|
|
|
|
|
template <template <class> class T>
|
|
|
|
struct Thing<T, true> { };
|
|
|
|
|
|
|
|
void template_template_fun(Type<Thing<Second, true>, Second>) { }
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "?template_template_fun@@YAXU?$Type@U?$Thing@USecond@@$00@@USecond@@@@@Z"
|
2013-08-06 06:26:46 +08:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void template_template_specialization();
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void template_template_specialization<void (Type<Thing<Second, true>, Second>)>() {
|
|
|
|
}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "??$template_template_specialization@$$A6AXU?$Type@U?$Thing@USecond@@$00@@USecond@@@@@Z@@YAXXZ"
|
2013-08-06 06:26:46 +08:00
|
|
|
|
2013-08-06 05:33:59 +08:00
|
|
|
// PR16788
|
|
|
|
template <decltype(nullptr)> struct S1 {};
|
|
|
|
void f(S1<nullptr>) {}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "?f@@YAXU?$S1@$0A@@@@Z"
|
2013-08-13 09:25:35 +08:00
|
|
|
|
|
|
|
struct record {
|
|
|
|
int first;
|
|
|
|
int second;
|
|
|
|
};
|
|
|
|
template <const record &>
|
|
|
|
struct type1 {
|
|
|
|
};
|
|
|
|
extern const record inst;
|
|
|
|
void recref(type1<inst>) {}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "?recref@@YAXU?$type1@$E?inst@@3Urecord@@B@@@Z"
|
2013-08-13 14:32:20 +08:00
|
|
|
|
|
|
|
struct _GUID {};
|
|
|
|
struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid;
|
|
|
|
|
|
|
|
template <typename T, const _GUID *G = &__uuidof(T)>
|
|
|
|
struct UUIDType1 {};
|
|
|
|
|
|
|
|
template <typename T, const _GUID &G = __uuidof(T)>
|
|
|
|
struct UUIDType2 {};
|
|
|
|
|
|
|
|
void fun(UUIDType1<uuid> a) {}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "?fun@@YAXU?$UUIDType1@Uuuid@@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@@Z"
|
2013-08-13 14:32:20 +08:00
|
|
|
void fun(UUIDType2<uuid> b) {}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "?fun@@YAXU?$UUIDType2@Uuuid@@$E?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@@Z"
|
2013-08-16 16:29:13 +08:00
|
|
|
|
|
|
|
template <typename T> struct TypeWithFriendDefinition {
|
|
|
|
friend void FunctionDefinedWithInjectedName(TypeWithFriendDefinition<T>) {}
|
|
|
|
};
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call {{.*}} @"?FunctionDefinedWithInjectedName@@YAXU?$TypeWithFriendDefinition@H@@@Z"
|
2013-08-16 16:29:13 +08:00
|
|
|
void CallFunctionDefinedWithInjectedName() {
|
|
|
|
FunctionDefinedWithInjectedName(TypeWithFriendDefinition<int>());
|
|
|
|
}
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: @"?FunctionDefinedWithInjectedName@@YAXU?$TypeWithFriendDefinition@H@@@Z"
|
2014-06-11 04:06:25 +08:00
|
|
|
|
|
|
|
// We need to be able to feed GUIDs through a couple rounds of template
|
|
|
|
// substitution.
|
|
|
|
template <const _GUID *G>
|
|
|
|
struct UUIDType3 {
|
|
|
|
void foo() {}
|
|
|
|
};
|
|
|
|
template <const _GUID *G>
|
|
|
|
struct UUIDType4 : UUIDType3<G> {
|
|
|
|
void bar() { UUIDType4::foo(); }
|
|
|
|
};
|
|
|
|
template struct UUIDType4<&__uuidof(uuid)>;
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: "?bar@?$UUIDType4@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@QAEXXZ"
|
|
|
|
// CHECK: "?foo@?$UUIDType3@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@QAEXXZ"
|
2020-09-21 14:18:04 +08:00
|
|
|
|
|
|
|
#ifdef _WIN64
|
|
|
|
template<__int128 N> struct Int128 {};
|
|
|
|
template<unsigned __int128 N> struct UInt128 {};
|
|
|
|
// X64: define {{.*}} @"?fun_int128@@YAXU?$Int128@$0A@@@@Z"(
|
|
|
|
void fun_int128(Int128<0>) {}
|
|
|
|
// X64: define {{.*}} @"?fun_int128@@YAXU?$Int128@$0?0@@@Z"(
|
|
|
|
void fun_int128(Int128<-1>) {}
|
|
|
|
// X64: define {{.*}} @"?fun_int128@@YAXU?$Int128@$0DPPPPPPPPPPPPPPPAAAAAAAAAAAAAAAB@@@@Z"(
|
|
|
|
void fun_int128(Int128<(__int128)9223372036854775807 * (__int128)9223372036854775807>) {}
|
|
|
|
// X64: define {{.*}} @"?fun_uint128@@YAXU?$UInt128@$0A@@@@Z"(
|
|
|
|
void fun_uint128(UInt128<0>) {}
|
|
|
|
// X64: define {{.*}} @"?fun_uint128@@YAXU?$UInt128@$0?0@@@Z"(
|
|
|
|
void fun_uint128(UInt128<(unsigned __int128)-1>) {}
|
|
|
|
// X64: define {{.*}} @"?fun_uint128@@YAXU?$UInt128@$0DPPPPPPPPPPPPPPPAAAAAAAAAAAAAAAB@@@@Z"(
|
|
|
|
void fun_uint128(UInt128<(unsigned __int128)9223372036854775807 * (unsigned __int128)9223372036854775807>) {}
|
|
|
|
#endif
|