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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> GCC trunk seemly only rejects the template member function as being
> ambigious though.

Yes, because https://eel.is/c++draft/namespace.udecl#11 says "The set of
declarations named by a using-declarator that inhabits a class C does not
include member functions and member function templates of a base class that
correspond to (and thus would conflict with) a declaration of a function or
function template in C."

And "correspond" is defined in terms of the parameters for non-template
functions, while it considers the return type for function templates.  So A::g
corresponds to B::g (and so is not added), but A::f does not correspond to B::f
(and is added).

So both declarations of f are candidates.  As others have pointed out, there is
no difference in the conversion for the object parameter.  The return type does
not participate in overload resolution.  And I don't see anything in
[over.match.best] that would apply here.

The tiebreaker in https://eel.is/c++draft/over#match.best.general-2.7 was
originally proposed to apply to all functions, but was limited to only
constructors at the 2017-05-08 CWG teleconference.

So I agree with Patrick, this seems ambiguous under the current draft.  It is
mysterious why Clang would treat this differently from the non-template default
argument case.

Reply via email to