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

            Bug ID: 96602
           Summary: Partial ordering is ambiguous with default function
                    arguments
           Product: gcc
           Version: 10.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: ---

Reduced from StackOverflow (https://stackoverflow.com/q/63390165/2069064):

template <typename T>
constexpr int foo(int=0){
    return 0;
}

template <typename T, typename... Args>
constexpr int foo(int=0, Args&&... args)
{    
    return 1;
}

static_assert(foo<int>() == 0);

gcc considers this call ambiguous. 

However,

static_assert(foo<int>(0) == 0);

succeeds. But the presence of an explicit argument shouldn't matter here.
Removing the leading, non-deduced T, gcc does accept:

constexpr int foo(int=0){
    return 0;
}

template <typename... Args>
constexpr int foo(int=0, Args&&... args)
{    
    return 1;
}

static_assert(foo() == 0);

even without the argument. So there's some interplay here.

Reply via email to