// PR c++/62134 // { dg-do compile { target c++11 } } template struct tuple; template<__SIZE_TYPE__, typename U> struct tuple_element; template struct enable_if { }; template struct enable_if { typedef T type; }; template struct int_t { static constexpr int value = V; }; template int constexpr int_t::value; template struct Index { static int const value = -1; }; template struct Index, Val, i> { static int const value = i; }; template struct Index, Val, i> { static int const value = Index, Val, i+1>::value; }; template struct PermutationSign; template struct PermutationSignIfFound { static int const value = 0; }; template struct PermutationSignIfFound<-1, C, R> { static int const value = 0; }; template <> struct PermutationSign, tuple<>> { static int const value = 1; }; template struct PermutationSign> { static int const value = 0; }; template struct PermutationSign, R> { static int const value = 0; }; template struct PermutationSign { static int const value = PermutationSignIfFound ::type>::value, C, Org>::value; }; template class Pred, int i=0, class Enable=void> struct IndexIf { static int const value = -1; using type = tuple<>; }; template class Pred, int i> struct IndexIf, Pred, i, typename enable_if::value>::type> { using type = A0; static int const value = i; }; template class Pred, int i> struct IndexIf, Pred, i, typename enable_if::value>::type> { using next = IndexIf, Pred, i+1>; using type = typename next::type; static int const value = next::value; }; template struct MatchPermutationP { template using type = PermutationSign; }; template struct FindCombination { using type = IndexIf::template type>; static int const where = type::value; static int const sign = (where>=0) ? PermutationSign::value : 0; }; int main() { using finder = FindCombination, tuple>>; static_assert(finder::where==0 && finder::sign==+1, "bad"); }