public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR libstdc++/98842: Fixed Constraints on operator<=>(optional,  U)
@ 2021-06-03 16:25 Seija K.
  2021-06-04 20:41 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Seija K. @ 2021-06-03 16:25 UTC (permalink / raw)
  To: gcc-patches, libstdc++

The original operator was underconstrained. _Up needs to fulfill
compare_three_way_result,
as mentioned in this bug report
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98842

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<typename _Tp, typename _Up>
+  template<typename _Tp, three_way_comparable_with<_Tp> _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; }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-13 21:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 16:25 [PATCH] PR libstdc++/98842: Fixed Constraints on operator<=>(optional, U) Seija K.
2021-06-04 20:41 ` Jonathan Wakely
2021-06-07 15:29   ` Jonathan Wakely
2021-06-13 21:59     ` Seija K.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).