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