[PATCH] D45680: [C++2a] Add operator<=> Rewriting - Early Attempt
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 16 21:17:54 PDT 2018
EricWF added inline comments.
================
Comment at: lib/Sema/SemaOverload.cpp:9218-9219
+ // --- F2 is a rewritten candidate ([over.match.oper]) and F1 is not.
+ if (Cand2.getRewrittenKind() && !Cand1.getRewrittenKind())
+ return true;
+ if (Cand1.getRewrittenKind() && Cand2.getRewrittenKind() &&
----------------
EricWF wrote:
> EricWF wrote:
> > rsmith wrote:
> > > You also need to check the reverse condition and return false (the "or if not that" is ... somehow ... supposed to imply that).
> > Hmm. So I'm wondering what is intended by the language `F1 and F2 are rewritten candidates, and F2 is a synthesized candidate with reversed order of parameters and F1 is not`. For example, what happens when comparing two distinct member functions with only one explicit parameter?
> >
> > ```
> > struct T;
> > struct U { auto operator<=>(T); };
> > struct T { auto operator<=>(U); };
> > auto r = T{} < U{}; // Are the synthesized and rewritten overloads ambiguous?
> > ```
> And what about
>
> ```
> struct U {};
> struct T { auto operator<=>(U); };
> auto operator<=>(U, T);
> auto r = T{} < U{};
> ```
Nevermind. I found the language. The implicit object parameter isn't considered in this case.
Repository:
rC Clang
https://reviews.llvm.org/D45680
More information about the cfe-commits
mailing list