Closed xmh0511 closed 1 year ago
y <=> x
finds auto operator <=>(A&, const A&)
, so the reversed version is auto operator <=>(const A&, A&)
For the first argument, from x
to A&
and x
to const A&
, the ICS of F1
trumps F2
, for the second argument, from x
to const A&
and x
to A&
, the ICS of F2
trumps F1
, so there are ambiguous.
Full name of submitter (unless configured in github; will be published with the issue): Jim X
Consider this example:
For the relation operator
<
, [over.match.oper] p3.4.1 says:[over.match.oper] p3.4.2 says:
That is, the candidates are:
Even though such two rewritten candidates are sourced from the same one, however, [over.match.best.general] p2.9 explicitly says:
That means,
F1
trumpsF2
anyway whenF1
andF2
are both viable candidates. However, Clang says:GCC says:
If I didn't miss something, it seems there is no wording in the current standard that says so. https://godbolt.org/z/1faqzTEE3