xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/variadic-templates.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc template<typename ...Types>
get_num_types(Types...)4*f4a2713aSLionel Sambuc int get_num_types(Types...) {
5*f4a2713aSLionel Sambuc   return sizeof...(Types);
6*f4a2713aSLionel Sambuc }
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc // CHECK-LABEL: define weak_odr i32 @_Z13get_num_typesIJifdEEiDpT_
9*f4a2713aSLionel Sambuc // CHECK: ret i32 3
10*f4a2713aSLionel Sambuc template int get_num_types(int, float, double);
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc // PR10260 - argument packs that expand to nothing
13*f4a2713aSLionel Sambuc namespace test1 {
foo()14*f4a2713aSLionel Sambuc   template <class... T> void foo() {
15*f4a2713aSLionel Sambuc     int values[sizeof...(T)+1] = { T::value... };
16*f4a2713aSLionel Sambuc     // CHECK-LABEL: define linkonce_odr void @_ZN5test13fooIJEEEvv()
17*f4a2713aSLionel Sambuc     // CHECK: alloca [1 x i32], align 4
18*f4a2713aSLionel Sambuc   }
19*f4a2713aSLionel Sambuc 
test()20*f4a2713aSLionel Sambuc   void test() {
21*f4a2713aSLionel Sambuc     foo<>();
22*f4a2713aSLionel Sambuc   }
23*f4a2713aSLionel Sambuc }
24