C++ Logo

std-discussion

Advanced search

[exec.when.all] sends-stopped references undefined Env

From: Abhinav Agarwal <abhinavagarwal1996_at_[hidden]>
Date: Sun, 26 Apr 2026 16:52:21 -0700
While reading N5032 [exec.when.all], I noticed what looks like a wording
defect introduced by P3887R1 ("Make when_all a Ronseal Algorithm"). In
state-type::complete, the stopped-disposition branch says, in effect:

  if constexpr (sends-stopped) {
    on_stop.reset();
    set_stopped(std::move(rcvr));
  }

where sends-stopped is true iff there exists an element S of Sndrs such
that

  completion_signatures_of_t<S, when-all-env<Env>>

contains set_stopped_t().

I do not think Env is in scope here. state-type::complete is specified in
the context of make-state<Rcvr>::operator()<Sndrs...>, so the available
template parameters are Rcvr and Sndrs.... Env is a template parameter of
check-types<Sndr, Env...>, where the related when-all-env<Env> idiom is
used, but that scope is not active inside complete.

The natural fix seems to be:

  completion_signatures_of_t<S, when-all-env<env_of_t<Rcvr>>>

which is consistent with the same make-state wording's reliance on
env_of_t<Rcvr>. The same wording appears in P3887R1, so the issue appears
to originate in the adopted paper wording.

There is a closely analogous precedent in the same section: LWG 4438
("Bad expression in [exec.when.all]") handled similar
dangling/undefined-name wording in make-when-all-env.

Am I reading this correctly, and is this already tracked? I did not find
a matching open issue. If it is not already tracked, I would be happy to
send a formal LWG.

-- Abhinav Agarwal

Received on 2026-04-26 23:52:50