@@ -1140,11 +1140,15 @@ class expected : private __expected_base<_Tp, _Err> {
11401140
11411141 // [expected.object.eq], equality operators
11421142 template <class _T2 , class _E2 >
1143+ # if _LIBCPP_STD_VER >= 26
11431144 requires (!is_void_v<_T2> &&
11441145 requires (const _Tp& __tp, const _T2& __t2, const _Err& __err, const _E2& __e2) {
11451146 { __tp == __t2 } -> convertible_to<bool >;
11461147 { __err == __e2 } -> convertible_to<bool >;
11471148 })
1149+ # else
1150+ requires (!is_void_v<_T2>)
1151+ # endif
11481152 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const expected<_T2, _E2>& __y) {
11491153 if (__x.__has_val () != __y.__has_val ()) {
11501154 return false ;
@@ -1158,18 +1162,22 @@ class expected : private __expected_base<_Tp, _Err> {
11581162 }
11591163
11601164 template <class _T2 >
1165+ # if _LIBCPP_STD_VER >= 26
11611166 requires (!__is_std_expected<_T2>::value &&
11621167 requires (const _Tp& __tp, const _T2& __t2) {
11631168 { __tp == __t2 } -> convertible_to<bool >;
11641169 })
1170+ # endif
11651171 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const _T2& __v) {
11661172 return __x.__has_val () && static_cast <bool >(__x.__val () == __v);
11671173 }
11681174
11691175 template <class _E2 >
1176+ # if _LIBCPP_STD_VER >= 26
11701177 requires requires (const _Err& __err, const _E2& __e2) {
11711178 { __err == __e2 } -> convertible_to<bool >;
11721179 }
1180+ # endif
11731181 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const unexpected<_E2>& __e) {
11741182 return !__x.__has_val () && static_cast <bool >(__x.__unex () == __e.error ());
11751183 }
@@ -1862,10 +1870,14 @@ class expected<_Tp, _Err> : private __expected_void_base<_Err> {
18621870
18631871 // [expected.void.eq], equality operators
18641872 template <class _T2 , class _E2 >
1873+ # if _LIBCPP_STD_VER >= 26
18651874 requires (is_void_v<_T2> &&
18661875 requires (const _Err& __err, const _E2& __e2) {
18671876 { __err == __e2 } -> convertible_to<bool >;
18681877 })
1878+ # else
1879+ requires is_void_v<_T2>
1880+ # endif
18691881 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const expected<_T2, _E2>& __y) {
18701882 if (__x.__has_val () != __y.__has_val ()) {
18711883 return false ;
@@ -1875,9 +1887,11 @@ class expected<_Tp, _Err> : private __expected_void_base<_Err> {
18751887 }
18761888
18771889 template <class _E2 >
1890+ # if _LIBCPP_STD_VER >= 26
18781891 requires requires (const _Err& __err, const _E2& __e2) {
18791892 { __err == __e2 } -> convertible_to<bool >;
18801893 }
1894+ # endif
18811895 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator ==(const expected& __x, const unexpected<_E2>& __y) {
18821896 return !__x.__has_val () && static_cast <bool >(__x.__unex () == __y.error ());
18831897 }
0 commit comments