https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98842
--- Comment #2 from g...@nicholas-schwab.de --- Created attachment 50063 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50063&action=edit Patch operator<=> The operator<=>(optional<_Tp>, _Up) is currently underconstrained. cf http://eel.is/c++draft/optional.comp.with.t#25 . This patch fixes this by adding the constraint three_way_comparable_with<_Tp> for _Up. Then in the program that started this bug report std::optional<expr>{} <=> std::optional<expr>{} will not compile if operator==(expr, expr) is not declared.