brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 2fc2cb2 Raw
78 lines · cpp
1// RUN: %clang_cc1 -Wno-error=return-type -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s2 3template<unsigned I, typename ...Types>4struct X { };5 6template<typename T> struct identity { using type = T; };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 { };11template<typename ...T> using ArrayOfN = int[sizeof...(T)];12 13// CHECK-LABEL: define weak_odr void @_Z2f0IJEEv1XIXsZT_EJDpRT_EE14template<typename ...Types>15void f0(X<sizeof...(Types), Types&...>) { }16 17template void f0(X<0>);18 19// CHECK-LABEL: define weak_odr void @_Z2f0IJifdEEv1XIXsZT_EJDpRT_EE20template void f0<int, float, double>(X<3, int&, float&, double&>);21 22// Mangling for template argument packs23template<typename ...Types> void f1() {}24// CHECK-LABEL: define weak_odr void @_Z2f1IJEEvv25template void f1<>();26// CHECK-LABEL: define weak_odr void @_Z2f1IJiEEvv27template void f1<int>();28// CHECK-LABEL: define weak_odr void @_Z2f1IJifEEvv29template void f1<int, float>();30 31// Mangling function parameter packs32template<typename ...Types> void f2(Types...) {}33// CHECK-LABEL: define weak_odr void @_Z2f2IJEEvDpT_34template void f2<>();35// CHECK-LABEL: define weak_odr void @_Z2f2IJiEEvDpT_36template void f2<int>(int);37// CHECK-LABEL: define weak_odr void @_Z2f2IJifEEvDpT_38template void f2<int, float>(int, float);39 40// Mangling non-trivial function parameter packs41template<typename ...Types> void f3(const Types *...) {}42// CHECK-LABEL: define weak_odr void @_Z2f3IJEEvDpPKT_43template void f3<>();44// CHECK-LABEL: define weak_odr void @_Z2f3IJiEEvDpPKT_45template void f3<int>(const int*);46// CHECK-LABEL: define weak_odr void @_Z2f3IJifEEvDpPKT_47template void f3<int, float>(const int*, const float*);48 49// Mangling of type pack expansions in a template argument50template<typename ...Types> tuple<Types...> f4() { return {}; }51// CHECK-LABEL: define weak_odr void @_Z2f4IJifdEE5tupleIJDpT_EEv52template tuple<int, float, double> f4();53 54// Mangling of type pack expansions in a function type55template<typename R, typename ...ArgTypes> identity<R(ArgTypes...)> f5() {}56// CHECK-LABEL: define weak_odr void @_Z2f5IiJifdEE8identityIFT_DpT0_EEv57template identity<int(int, float, double)> f5();58 59// Mangling of non-type template argument expansions60template<int ...Values> int_tuple<Values...> f6() {}61// CHECK-LABEL: define weak_odr void @_Z2f6IJLi1ELi2ELi3EEE9int_tupleIJXspT_EEEv62template int_tuple<1, 2, 3> f6();63 64// Mangling of template template argument expansions65template<template<typename> class ...Templates> 66template_tuple<Templates...> f7() {}67// CHECK-LABEL: define weak_odr void @_Z2f7IJ8identity13add_referenceEE14template_tupleIJDpT_EEv68template template_tuple<identity, add_reference> f7();69 70template<typename T, typename ...U> void f8(ArrayOfN<int, U..., T, typename U::type...>&) {}71// CHECK-LABEL: define weak_odr void @_Z2f8IiJ8identityIiES0_IfEEEvRAsPiDpT0_T_DpNS3_4typeEE_i72template void f8<int, identity<int>, identity<float>>(int (&)[6]);73 74template<typename ...T> void f10(ArrayOfN<T...> &) {}75// FIXME: This is wrong; should be @_Z3f10IJifEEvRAsZT__i76// CHECK-LABEL: define weak_odr void @_Z3f10IJifEEvRAsPDpT_E_i77template void f10<int, float>(int (&)[2]);78