[libcxx-commits] [libcxx] [llvm] [libc++] Implement P3379R0 Constrain `std::expected` equality operators (PR #135759)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 29 05:02:27 PDT 2025


================
@@ -1851,7 +1871,14 @@ class expected<_Tp, _Err> : private __expected_void_base<_Err> {
   // [expected.void.eq], equality operators
   template <class _T2, class _E2>
     requires is_void_v<_T2>
-  _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) {
+  _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y)
+#  if _LIBCPP_STD_VER >= 26
+
+    requires requires {
+      { __x.error() == __y.error() } -> __core_convertible_to<bool>;
----------------
yronglin wrote:

Thanks, removed.

https://github.com/llvm/llvm-project/pull/135759


More information about the libcxx-commits mailing list