https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96489
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to DV Henkel-Wallace from comment #2) > I don't think this should be marked as resolved. The bug is not the case > you cited which indeed works properly as specified. > > The bug is that comparators are not being synthesized when the a *user > supplied* operator<=> is defined. They're not supposed to be, because as I quoted above, the == operator is only sythesized when <=> is defined as defaulted. > I believe this case is [class.spaceship] case (1.1). Although that case > does reference [class.compare.default], it talks about the spaceship > operator being "usable" which is defined, via clause (3), to have a defined > binary operator of appropriate types -- _not_ claiming that only the `= > default` case applies. > > > More pragmatically the user will expect that their explicit definition of > <=> will result in unspecified comparisons being synthesized. Else why > define it in the first place? Because you get the < > <= >= operators for free. But you only get == for free if <=> is defined as defaulted, and you only get != for free if == exists. I think to get what you expect, you need to either define <=> as defaulted, or define == as defaulted. If you have a user-provided operator<=> and no operator== declared, then you get no ==.