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

            Bug ID: 80871
           Summary: Template partial ordering considered non-ambiguous
                    with deduced and non-deduced parameter packs
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Consider this example:

#ifdef VARIADIC
    template <class... Ts, class... Us> 
    constexpr int foo(Us... ) { return 1; }

    template <class... Us> 
    constexpr int foo(Us... ) { return 2; }
#else
    template <class... Ts, class U>
    constexpr int foo(U ) { return 1; }

    template <class U>
    constexpr int foo(U ) { return 2; }
#endif

int main() {
    static_assert(foo(1) == 1, "!"); 
}

Without -DVARIADIC, the call to foo(1) is considered ambiguous and the program
fails to compile. But with -DVARIADIC, the program compiles. The call should be
ambiguous, since Ts... does not participate in partial ordering.

Reply via email to