1// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s 2 3template<unsigned I, typename ...Types> 4struct X { }; 5 6template<typename T> struct identity { }; 7template<typename T> struct add_reference; 8template<typename ...Types> struct tuple { }; 9template<int ...Values> struct int_tuple { }; 10template<template<typename> class ...Templates> struct template_tuple { }; 11 12// CHECK-LABEL: define weak_odr void @_Z2f0IJEEv1XIXsZT_EJDpRT_EE 13template<typename ...Types> 14void f0(X<sizeof...(Types), Types&...>) { } 15 16template void f0(X<0>); 17 18// CHECK-LABEL: define weak_odr void @_Z2f0IJifdEEv1XIXsZT_EJDpRT_EE 19template void f0<int, float, double>(X<3, int&, float&, double&>); 20 21// Mangling for template argument packs 22template<typename ...Types> void f1() {} 23// CHECK-LABEL: define weak_odr void @_Z2f1IJEEvv 24template void f1<>(); 25// CHECK-LABEL: define weak_odr void @_Z2f1IJiEEvv 26template void f1<int>(); 27// CHECK-LABEL: define weak_odr void @_Z2f1IJifEEvv 28template void f1<int, float>(); 29 30// Mangling function parameter packs 31template<typename ...Types> void f2(Types...) {} 32// CHECK-LABEL: define weak_odr void @_Z2f2IJEEvDpT_ 33template void f2<>(); 34// CHECK-LABEL: define weak_odr void @_Z2f2IJiEEvDpT_ 35template void f2<int>(int); 36// CHECK-LABEL: define weak_odr void @_Z2f2IJifEEvDpT_ 37template void f2<int, float>(int, float); 38 39// Mangling non-trivial function parameter packs 40template<typename ...Types> void f3(const Types *...) {} 41// CHECK-LABEL: define weak_odr void @_Z2f3IJEEvDpPKT_ 42template void f3<>(); 43// CHECK-LABEL: define weak_odr void @_Z2f3IJiEEvDpPKT_ 44template void f3<int>(const int*); 45// CHECK-LABEL: define weak_odr void @_Z2f3IJifEEvDpPKT_ 46template void f3<int, float>(const int*, const float*); 47 48// Mangling of type pack expansions in a template argument 49template<typename ...Types> tuple<Types...> f4() {} 50// CHECK-LABEL: define weak_odr void @_Z2f4IJifdEE5tupleIJDpT_EEv 51template tuple<int, float, double> f4(); 52 53// Mangling of type pack expansions in a function type 54template<typename R, typename ...ArgTypes> identity<R(ArgTypes...)> f5() {} 55// CHECK-LABEL: define weak_odr void @_Z2f5IiJifdEE8identityIFT_DpT0_EEv 56template identity<int(int, float, double)> f5(); 57 58// Mangling of non-type template argument expansions 59template<int ...Values> int_tuple<Values...> f6() {} 60// CHECK-LABEL: define weak_odr void @_Z2f6IJLi1ELi2ELi3EEE9int_tupleIJXspT_EEEv 61template int_tuple<1, 2, 3> f6(); 62 63// Mangling of template template argument expansions 64template<template<typename> class ...Templates> 65template_tuple<Templates...> f7() {} 66// CHECK-LABEL: define weak_odr void @_Z2f7IJ8identity13add_referenceEE14template_tupleIJDpT_EEv 67template template_tuple<identity, add_reference> f7(); 68