2011-10-14 06:29:44 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s
|
2011-01-05 06:16:00 +08:00
|
|
|
|
|
|
|
template<unsigned I, typename ...Types>
|
|
|
|
struct X { };
|
|
|
|
|
2011-01-14 00:39:34 +08:00
|
|
|
template<typename T> struct identity { };
|
|
|
|
template<typename T> struct add_reference;
|
|
|
|
template<typename ...Types> struct tuple { };
|
|
|
|
template<int ...Values> struct int_tuple { };
|
|
|
|
template<template<typename> class ...Templates> struct template_tuple { };
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f0IJEEv1XIXsZT_EJDpRT_EE
|
2011-01-05 06:16:00 +08:00
|
|
|
template<typename ...Types>
|
|
|
|
void f0(X<sizeof...(Types), Types&...>) { }
|
|
|
|
|
|
|
|
template void f0(X<0>);
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f0IJifdEEv1XIXsZT_EJDpRT_EE
|
2011-01-05 06:16:00 +08:00
|
|
|
template void f0<int, float, double>(X<3, int&, float&, double&>);
|
2011-01-14 00:39:34 +08:00
|
|
|
|
|
|
|
// Mangling for template argument packs
|
|
|
|
template<typename ...Types> void f1() {}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f1IJEEvv
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f1<>();
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f1IJiEEvv
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f1<int>();
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f1IJifEEvv
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f1<int, float>();
|
|
|
|
|
|
|
|
// Mangling function parameter packs
|
|
|
|
template<typename ...Types> void f2(Types...) {}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f2IJEEvDpT_
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f2<>();
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f2IJiEEvDpT_
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f2<int>(int);
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f2IJifEEvDpT_
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f2<int, float>(int, float);
|
|
|
|
|
|
|
|
// Mangling non-trivial function parameter packs
|
|
|
|
template<typename ...Types> void f3(const Types *...) {}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f3IJEEvDpPKT_
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f3<>();
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f3IJiEEvDpPKT_
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f3<int>(const int*);
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f3IJifEEvDpPKT_
|
2011-01-14 00:39:34 +08:00
|
|
|
template void f3<int, float>(const int*, const float*);
|
|
|
|
|
|
|
|
// Mangling of type pack expansions in a template argument
|
|
|
|
template<typename ...Types> tuple<Types...> f4() {}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f4IJifdEE5tupleIJDpT_EEv
|
2011-01-14 00:39:34 +08:00
|
|
|
template tuple<int, float, double> f4();
|
|
|
|
|
|
|
|
// Mangling of type pack expansions in a function type
|
|
|
|
template<typename R, typename ...ArgTypes> identity<R(ArgTypes...)> f5() {}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f5IiJifdEE8identityIFT_DpT0_EEv
|
2011-01-14 00:39:34 +08:00
|
|
|
template identity<int(int, float, double)> f5();
|
|
|
|
|
|
|
|
// Mangling of non-type template argument expansions
|
|
|
|
template<int ...Values> int_tuple<Values...> f6() {}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f6IJLi1ELi2ELi3EEE9int_tupleIJXspT_EEEv
|
2011-01-14 00:39:34 +08:00
|
|
|
template int_tuple<1, 2, 3> f6();
|
|
|
|
|
|
|
|
// Mangling of template template argument expansions
|
|
|
|
template<template<typename> class ...Templates>
|
|
|
|
template_tuple<Templates...> f7() {}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define weak_odr void @_Z2f7IJ8identity13add_referenceEE14template_tupleIJDpT_EEv
|
2011-01-14 00:39:34 +08:00
|
|
|
template template_tuple<identity, add_reference> f7();
|