1010#define _LIBCPP___EXPECTED_EXPECTED_H
1111
1212#include < __assert>
13- #include < __concepts/boolean_testable .h>
13+ #include < __concepts/core_convertible_to .h>
1414#include < __config>
1515#include < __expected/bad_expected_access.h>
1616#include < __expected/unexpect.h>
@@ -1141,10 +1141,13 @@ class expected : private __expected_base<_Tp, _Err> {
11411141 // [expected.object.eq], equality operators
11421142 template <class _T2 , class _E2 >
11431143 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const expected<_T2, _E2>& __y)
1144- requires (!is_void_v<_T2>) && requires {
1145- { *__x == *__y } -> __boolean_testable;
1146- { __x.error () == __y.error () } -> __boolean_testable;
1147- }
1144+ requires (!is_void_v<_T2>)
1145+ # if _LIBCPP_STD_VER >= 26
1146+ && requires {
1147+ { *__x == *__y } -> __core_convertible_to<bool >;
1148+ { __x.error () == __y.error () } -> __core_convertible_to<bool >;
1149+ }
1150+ # endif
11481151 {
11491152 if (__x.__has_val () != __y.__has_val ()) {
11501153 return false ;
@@ -1159,18 +1162,22 @@ class expected : private __expected_base<_Tp, _Err> {
11591162
11601163 template <class _T2 >
11611164 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const _T2& __v)
1165+ # if _LIBCPP_STD_VER >= 26
11621166 requires (!__is_std_expected<_T2>::value) && requires {
1163- { *__x == __v } -> __boolean_testable ;
1167+ { *__x == __v } -> __core_convertible_to< bool > ;
11641168 }
1169+ # endif
11651170 {
11661171 return __x.__has_val () && static_cast <bool >(__x.__val () == __v);
11671172 }
11681173
11691174 template <class _E2 >
11701175 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const unexpected<_E2>& __e)
1176+ # if _LIBCPP_STD_VER >= 26
11711177 requires requires {
1172- { __x.error () == __e.error () } -> __boolean_testable ;
1178+ { __x.error () == __e.error () } -> __core_convertible_to< bool > ;
11731179 }
1180+ # endif
11741181 {
11751182 return !__x.__has_val () && static_cast <bool >(__x.__unex () == __e.error ());
11761183 }
@@ -1865,9 +1872,12 @@ class expected<_Tp, _Err> : private __expected_void_base<_Err> {
18651872 template <class _T2 , class _E2 >
18661873 requires is_void_v<_T2>
18671874 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const expected<_T2, _E2>& __y)
1875+ # if _LIBCPP_STD_VER >= 26
1876+
18681877 requires requires {
1869- { __x.error () == __y.error () } -> __boolean_testable ;
1878+ { __x.error () == __y.error () } -> __core_convertible_to< bool > ;
18701879 }
1880+ # endif
18711881 {
18721882 if (__x.__has_val () != __y.__has_val ()) {
18731883 return false ;
@@ -1878,9 +1888,12 @@ class expected<_Tp, _Err> : private __expected_void_base<_Err> {
18781888
18791889 template <class _E2 >
18801890 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const unexpected<_E2>& __y)
1891+ # if _LIBCPP_STD_VER >= 26
1892+
18811893 requires requires {
1882- { __x.error () == __y.error () } -> __boolean_testable ;
1894+ { __x.error () == __y.error () } -> __core_convertible_to< bool > ;
18831895 }
1896+ # endif
18841897 {
18851898 return !__x.__has_val () && static_cast <bool >(__x.__unex () == __y.error ());
18861899 }
0 commit comments