[Bug libstdc++/96269] optional comparison with nullopt fails

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 5 17:41:51 GMT 2020


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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to sshannin from comment #6)
> I guess to rephrase, should there also be a specialized spaceship overload
> for the (nullopt_t, optional) direction to complement the (optional,
> nullopt) one?

No, the compiler synthesizes it from operator==(optional, nullopt_t) by
reversing the arguments. That's how comparisons work in C++20.


More information about the Gcc-bugs mailing list