[libcxx-commits] [libcxx] [libc++] P3798R1: The unexpected in std::expected (PR #204826)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 21 18:10:58 PDT 2026


================
@@ -825,6 +825,10 @@ class expected : private __expected_base<_Tp, _Err> {
 
   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
 
+#  if _LIBCPP_STD_VER >= 29 
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_error() const noexcept { return !this->has_value(); }
+#  endif
----------------
frederick-vs-ja wrote:

```suggestion
  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_error() const noexcept { return !this->has_value(); }
```

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


More information about the libcxx-commits mailing list