https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127209
Bug ID: 127209
Summary: partial ordering with reversed candidates has not been
implemented
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bbi5291 at gmail dot com
Target Milestone: ---
GCC rejects this test case (language modes c++20 and later) because it doesn't
select the more specialized overload. Clang and MSVC are doing the right thing:
https://godbolt.org/z/G36xsa9nY
-----
#include <compare>
template <class T>
struct A {};
template <class T>
struct B {};
template <class T, class U>
std::strong_ordering operator<=>(const A<T>&, const U&) = delete;
template <class T, class U>
std::strong_ordering operator<=>(const B<T>&, const A<U>&);
auto c = A<int>() <=> B<int>();
-----
[over.match.best.general]/2: partial ordering takes precedence over the rule
that non-rewritten candidates are preferred.
[temp.func.order]/5 post CWG2445: reversed and non-reversed candidates can be
partial-ordered by reversing the argument template.