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