diff --git a/include/zeus/expected.hpp b/include/zeus/expected.hpp index 556a561..0463be4 100644 --- a/include/zeus/expected.hpp +++ b/include/zeus/expected.hpp @@ -240,8 +240,15 @@ class unexpected friend constexpr void swap(unexpected &x, unexpected &y) noexcept(noexcept(x.swap(y))) { x.swap(y); } template - friend constexpr bool operator==(const unexpected &lhs, const unexpected &rhs) noexcept(noexcept(lhs.error() == rhs.error())) + friend constexpr bool operator==( + const unexpected &lhs, const unexpected &rhs + ) noexcept(expected_detail::is_nothrow_equality_result_convertible_to_bool_v) { + // [expected.un.eq] Mandates + static_assert( + expected_detail::is_equality_result_convertible_to_bool_v, + "The expression lhs.error() == rhs.error() must be well-formed and its result must be convertible to bool" + ); return lhs.error() == rhs.error(); } template