https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
--- Comment #9 from Ville Voutilainen ---
Ha, well spotted. In general, in a spaceship world, you do want to provide
comparisons symmetrically and const-correctly, and that also works in the
pre-spaceship world, thus:
#include
struct X {
tem
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
Jonathan Wakely changed:
What|Removed |Added
Last reconfirmed||2020-11-05
Keywords|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
--- Comment #7 from Jonathan Wakely ---
(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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
--- Comment #6 from sshannin at gmail dot com ---
Thanks to you both for your analysis. As I said, I wasn't sure if it was an
issue, so I'm certainly willing to accept that it's not.
The one point I wanted to emphasize though just to make sure we
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
--- Comment #5 from Ville Voutilainen ---
Oh, and if you define a spaceship operator for your type, then things work
again, with or without FLIP.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
Ville Voutilainen changed:
What|Removed |Added
CC||ville.voutilainen at gmail dot
com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
--- Comment #3 from Jonathan Wakely ---
I don't think this is a bug in std::optional, I think it's how C++20 works.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
--- Comment #2 from sshannin at gmail dot com ---
(In reply to Jonathan Wakely from comment #1)
> Your operator== should be const-qualified.
I don't disagree. I can also fully remove the operator== and it compiles as
well (why should the presence
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
--- Comment #1 from Jonathan Wakely ---
Your operator== should be const-qualified.