p21.cpp revision 762bb9d0ad20320b9f97a841dce57ba5e8e48b07
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2
3// Note: Template argument deduction involving parameter packs
4// (14.5.3) can deduce zero or more arguments for each parameter pack.
5
6template<class> struct X {
7  static const unsigned value = 0;
8};
9
10template<class R, class ... ArgTypes> struct X<R(int, ArgTypes ...)> {
11  static const unsigned value = 1;
12};
13
14template<class ... Types> struct Y {
15  static const unsigned value = 0;
16};
17
18template<class T, class ... Types> struct Y<T, Types& ...> {
19  static const unsigned value = 1;
20};
21
22template<class ... Types> int f(void (*)(Types ...));
23void g(int, float);
24
25int check0[X<int>::value == 0? 1 : -1]; // uses primary template
26int check1[X<int(int, float, double)>::value == 1? 1 : -1]; // uses partial specialization
27int check2[X<int(float, int)>::value == 0? 1 : -1]; // uses primary template
28int check3[Y<>::value == 0? 1 : -1]; // uses primary template
29int check4[Y<int&, float&, double&>::value == 1? 1 : -1]; // uses partial specialization
30int check5[Y<int, float, double>::value == 0? 1 : -1]; // uses primary template
31int fv = f(g); // okay
32