https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98842
g...@nicholas-schwab.de changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |g...@nicholas-schwab.de --- Comment #1 from g...@nicholas-schwab.de --- Three problem lies in the concept three_way_comparable_with. It uses __detail::__weakly_eq_cmp_with that requires u == t. Due to paper P1185 operator== will not lookup operator<=>. Therefore having only operator<=> defined does not suffice to fulfill __detail::__weakly_eq_cmp. Hence the first of these two templates is SFINAE'D out and the second is taken. template<typename _Tp, three_way_comparable_with<_Tp> _Up> constexpr compare_three_way_result_t<_Tp, _Up> operator<=>(const optional<_Tp>& __x, const optional<_Up>& __y) template<typename _Tp, typename _Up> constexpr compare_three_way_result_t<_Tp, _Up> operator<=>(const optional<_Tp>& __x, const _Up& __v) The second will however compare false whenever the left hand side is empty. The standard requires that three_way_comparable_with also requires weakly_equality_comparable. Hence the implementation of this concept is correct. However this might be a defect in the standard. Note that the standard also wants three_way_comparable_with<_Tp> for the second template (http://eel.is/c++draft/optional#comp.with.t-25). So the second template above is non-confirming. But it seems to me that a comparison between two optionals then is always ambiguous, so this should be a defect.