[libcxx-commits] [libcxx] [libc++] Resolve LWG4366: Heterogeneous comparison of `expected` may be ill-formed (PR #185342)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 9 01:07:50 PDT 2026


================
@@ -1169,7 +1169,9 @@ class expected : private __expected_base<_Tp, _Err> {
     }
 #  endif
   {
-    return __x.__has_val() && static_cast<bool>(__x.__val() == __v);
----------------
philnik777 wrote:

I think I'd rather have a `__convert_to_bool` function.

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


More information about the libcxx-commits mailing list