1 // RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s 2 3 namespace DeductionForInstantiation { 4 template<unsigned I, typename ...Types> 5 struct X { }; 6 7 template<typename ...Types> 8 void f0(X<sizeof...(Types), Types&...>) { } 9 10 // No explicitly-specified arguments 11 template void f0(X<0>); 12 template void f0(X<1, int&>); 13 template void f0(X<2, int&, short&>); 14 15 // One explicitly-specified argument 16 template void f0<float>(X<1, float&>); 17 template void f0<double>(X<1, double&>); 18 19 // Two explicitly-specialized arguments 20 template void f0<char, unsigned char>(X<2, char&, unsigned char&>); 21 template void f0<signed char, char>(X<2, signed char&, char&>); 22 23 // FIXME: Extension of explicitly-specified arguments 24 // template void f0<short, int>(X<3, short&, int&, long&>); 25 } 26 27 namespace DeductionWithConversion { 28 template<char...> struct char_values { 29 static const unsigned value = 0; 30 }; 31 32 template<int C1, char C3> 33 struct char_values<C1, 12, C3> { 34 static const unsigned value = 1; 35 }; 36 37 int check0[char_values<1, 12, 3>::value == 1? 1 : -1]; 38 39 template<int...> struct int_values { 40 static const unsigned value = 0; 41 }; 42 43 template<unsigned char C1, unsigned char C3> 44 struct int_values<C1, 12, C3> { 45 static const unsigned value = 1; 46 }; 47 48 int check1[int_values<256, 12, 3>::value == 0? 1 : -1]; 49 int check2[int_values<3, 12, 3>::value == 1? 1 : -1]; 50 } 51