Fixes and code cleanup for include/pfn/expected.hpp #189
Fixes and code cleanup for include/pfn/expected.hpp #189
include/pfn/expected.hpp #189Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
🤖 Augment PR SummarySummary: Cleans up and fixes the Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
| template <class E2> constexpr friend bool operator==(unexpected const &x, unexpected<E2> const &y) | ||
| template <class E2> | ||
| constexpr friend bool operator==(unexpected const &x, unexpected<E2> const &y) // | ||
| noexcept(noexcept(static_cast<bool>(x.error() == y.error()))) // extension |
There was a problem hiding this comment.
include/pfn/expected.hpp:149 — The noexcept computation uses static_cast<bool>(x.error() == y.error()); this can succeed even when the comparison result is only explicitly convertible to bool, while the return statement still requires an implicit conversion to bool. Consider aligning the noexcept/participation check with implicit convertibility to avoid surprising hard errors in some generic contexts.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
a784bcc to
553f03c
Compare
|


Changes summary:
is_assignable_v<T, U>, SFINAE-disabling the template for scalar T. Fixed and tightenednoexceptextension in the same.unexpected::operator==now useserror()instead of the private member, fixing heterogeneous comparison. Added anoexceptextension in the same.has_error()_can_convertinexpected<void, E>