[libcxx-commits] [libcxx] [libc++] Throw future_error in future.get() (PR #179409)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 6 10:13:52 PST 2026


================
@@ -985,6 +985,9 @@ future<_Rp>::~future() {
 
 template <class _Rp>
 _Rp future<_Rp>::get() {
+  if (__state_ == nullptr) [[unlikely]] {
+    __throw_future_error(future_errc::no_state);
----------------
ldionne wrote:

```suggestion
    std::__throw_future_error(future_errc::no_state);
```

We always qualify free function calls to prevent unintended ADL (and for consistency when ADL isn't a problem, like here).

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


More information about the libcxx-commits mailing list