[Bug c++/105200] user-defined operator <=> for enumerated types is ignored

falbrechtskirchinger at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 8 12:26:33 GMT 2022


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

--- Comment #3 from Florian Albrechtskirchinger <falbrechtskirchinger at gmail dot com> ---
(In reply to Jakub Jelinek from comment #2)
> If one defines instead say bool operator<(const foo, const foo);
> then the built-in candidate isn't considered because of
> https://eel.is/c++draft/over.match.oper#3.3
> But for the user operator<=> vs. built-in operator<, they don't have the
> same operator name, so the built-in operator< is in the candidate set.

My understanding is that the candidate set consists of the builtin operators
and the rewritten operators. But as you have pointed out, according to
https://eel.is/c++draft/over.match.best#general-2.8, the rewritten operator is
a worse choice than the builtin one.

Yet the other compilers disagree. And I have trouble believing the committee
wanted this inconsistent behavior between the legacy operators and spaceship.

Where do we go from here? File bugs with the other compilers? Ask the authors
of the papers on the spaceship operator?


More information about the Gcc-bugs mailing list