p3-0x.cpp revision 762bb9d0ad20320b9f97a841dce57ba5e8e48b07
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2
3namespace ParameterPacksWithFunctions {
4  template<typename ...> struct count;
5
6  template<typename Head, typename ...Tail>
7  struct count<Head, Tail...> {
8    static const unsigned value = 1 + count<Tail...>::value;
9  };
10
11  template<>
12  struct count<> {
13    static const unsigned value = 0;
14  };
15
16  template<unsigned> struct unsigned_c { };
17
18  template<typename ... Types>
19  unsigned_c<count<Types...>::value> f();
20
21  void test_f() {
22    unsigned_c<0> uc0a = f(); // okay, deduced to an empty pack
23    unsigned_c<0> uc0b = f<>();
24    unsigned_c<1> uc1 = f<int>();
25    unsigned_c<2> uc2 = f<float, double>();
26  }
27}
28