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