From 6944fdb20da8065004dc81052aa05e13cef39998 Mon Sep 17 00:00:00 2001 From: Nicholas42 Date: Tue, 26 Jan 2021 21:57:57 +0100 Subject: [PATCH] Fixed constraints on operator<=>(optional, U) operator<=>(std::optional<_Tp>,_Up) was underconstrained. _Up needs to fulfill std::three_way_comparable<_Tp>. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98842 and http://eel.is/c++draft/optional#comp.with.t-25. --- libstdc++-v3/include/std/optional | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 8b9e038e6e510..9e61c1b2cbfbd 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -1234,7 +1234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !__rhs || __lhs >= *__rhs; } #ifdef __cpp_lib_three_way_comparison - template + template _Up> constexpr compare_three_way_result_t<_Tp, _Up> operator<=>(const optional<_Tp>& __x, const _Up& __v) { return bool(__x) ? *__x <=> __v : strong_ordering::less; }