partial-ordering.cpp revision 77d6bb9e223496aa5288294f34e7225d1f65dddc
1// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s 2 3// Various tests related to partial ordering of variadic templates. 4template<typename ...Types> struct tuple; 5 6template<typename Tuple> 7struct X1 { 8 static const unsigned value = 0; 9}; 10 11template<typename Head, typename ...Tail> 12struct X1<tuple<Head, Tail...> > { 13 static const unsigned value = 1; 14}; 15 16template<typename Head, typename ...Tail> 17struct X1<tuple<Head, Tail&...> > { 18 static const unsigned value = 2; 19}; 20 21template<typename Head, typename ...Tail> 22struct X1<tuple<Head&, Tail&...> > { 23 static const unsigned value = 3; 24}; 25 26int check0[X1<tuple<>>::value == 0? 1 : -1]; 27int check1[X1<tuple<int>>::value == 2? 1 : -1]; 28int check2[X1<tuple<int, int>>::value == 1? 1 : -1]; 29int check3[X1<tuple<int, int&>>::value == 2? 1 : -1]; 30int check4[X1<tuple<int&, int&>>::value == 3? 1 : -1]; 31