https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90019

            Bug ID: 90019
           Summary: [8 regression] Bogus ambiguous overload error for NTTP
                    pack of disjoint enable_ifs unless there is an
                    unsupplied default argument
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redbeard0531 at gmail dot com
  Target Milestone: ---

This code compiles fine with 7 and trunk but fails with gcc8:
https://godbolt.org/z/v1HN8B

#include <type_traits>

// gcc8 thinks these are ambiguous for <0>
template <int I, std::enable_if_t<I == 0, int>...> void foo(){}
template <int I, std::enable_if_t<I != 0, int>...> void foo(){}

// but somehow these arn't for <0>, but are for <0,0> !?
template <int I, int=0, std::enable_if_t<I == 0, int>...> void bar(){}
template <int I, int=0, std::enable_if_t<I != 0, int>...> void bar(){}

void test() {
    bar<0>(); // works
    bar<0,0>(); // boom
    foo<0>(); // boom
}

Reply via email to