Home | History | Annotate | Download | only in temp.deduct.type
      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 
      6 template<class> struct X {
      7   static const unsigned value = 0;
      8 };
      9 
     10 template<class R, class ... ArgTypes> struct X<R(int, ArgTypes ...)> {
     11   static const unsigned value = 1;
     12 };
     13 
     14 template<class ... Types> struct Y {
     15   static const unsigned value = 0;
     16 };
     17 
     18 template<class T, class ... Types> struct Y<T, Types& ...> {
     19   static const unsigned value = 1;
     20 };
     21 
     22 template<class ... Types> int f(void (*)(Types ...));
     23 void g(int, float);
     24 
     25 int check0[X<int>::value == 0? 1 : -1]; // uses primary template
     26 int check1[X<int(int, float, double)>::value == 1? 1 : -1]; // uses partial specialization
     27 int check2[X<int(float, int)>::value == 0? 1 : -1]; // uses primary template
     28 int check3[Y<>::value == 0? 1 : -1]; // uses primary template
     29 int check4[Y<int&, float&, double&>::value == 1? 1 : -1]; // uses partial specialization
     30 int check5[Y<int, float, double>::value == 0? 1 : -1]; // uses primary template
     31 int fv = f(g); // okay
     32