[ms-cxxabi] Mangle variadic template parameter packs
Unlike Itanium, there is no code to indicate the beginning of a
parameter pack. I tested this with MSVC 2013, which is the only version
that implements variadic templates so far.
This is needed to compile APInt.cpp for the MS C++ ABI.
Reviewers: timurrrr
Differential Revision: http://llvm-reviews.chandlerc.com/D1077
llvm-svn: 185454
diff --git a/clang/test/CodeGenCXX/mangle-ms-templates.cpp b/clang/test/CodeGenCXX/mangle-ms-templates.cpp
index c52b6b4..363583a 100644
--- a/clang/test/CodeGenCXX/mangle-ms-templates.cpp
+++ b/clang/test/CodeGenCXX/mangle-ms-templates.cpp
@@ -133,3 +133,26 @@
// CHECK: "\01??$FunctionPointerTemplate@$1?spam@@YAXXZ@@YAXXZ"
// X64: "\01??$FunctionPointerTemplate@$1?spam@@YAXXZ@@YAXXZ"
}
+
+// Unlike Itanium, there is no character code to indicate an argument pack.
+// Tested with MSVC 2013, the first version which supports variadic templates.
+
+template <typename ...Ts> void variadic_fn_template(const Ts &...args) { }
+void variadic_fn_instantiate() {
+ variadic_fn_template(0, 1, 3, 4);
+ variadic_fn_template(0, 1, 'a', "b");
+}
+// CHECK: "\01??$variadic_fn_template@HHHH@@YAXABH000@Z"
+// CHECK: "\01??$variadic_fn_template@HHD$$BY01D@@YAXABH0ABDAAY01$$CBD@Z"
+
+template <typename ...Ts>
+struct VariadicClass {
+ VariadicClass() { }
+ int x;
+};
+void variadic_class_instantiate() {
+ VariadicClass<int, char, bool> a;
+ VariadicClass<bool, char, int> b;
+}
+// CHECK: call {{.*}} @"\01??0?$VariadicClass@HD_N@@QAE@XZ"
+// CHECK: call {{.*}} @"\01??0?$VariadicClass@_NDH@@QAE@XZ"