This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ BUG] Fix 23513


Nathan Sidwell wrote:
> This patch fixes 23513, a template specialization ordering problem.  I'd
> like Mark and Jason's thoughts before committing, as I can find no words
> in the std or DR214 to justify the behaviour this implements.
> 
> It would seem sensible to allow some kind of ordering between a
> non-static member function and a non-member function, when both are
> found during name lookup for an operator.  I have determined that the
> EDG3.6 compiler behaves as if the first argument is ignored in this
> circumstance -- I've asked on the core list, but received no responses.

I think your patch makes sense.

I agree that this is underspecified, and that the other obvious
alternative is to consider non-static member functions to have a first
argument of type "cv-qualified T&", with "T" the class of which they are
a member.  If the call is valid at all, that's going to be a very
favorable conversion; an exact match, or, at most, a derived-to-base
conversion.  Ignoring that possibility means that we might decide things
are ambiguous when we might otherwise decide things.  But, I don't think
that we'd pick one case where ignoring the first argument (as per your
patch) means we'd pick the other.  So, in some sense, your patch is
conservative: if the committee decides at some point to include the
first argument, strictly more programs will compile, and all programs
that compiled before will still have the same meaning.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]