This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4579. make-state<Rcvr>::state-type::complete uses Env which is not in scope

Section: 33.9.12.12 [exec.when.all] Status: New Submitter: Abhinav Agarwal Opened: 2026-05-12 Last modified: 2026-05-17

Priority: Not Prioritized

View other active issues in [exec.when.all].

View all other issues in [exec.when.all].

View all issues with New status.

Discussion:

In 33.9.12.12 [exec.when.all], the specification of make-state::state-type::complete (paragraph 15, bullet (15.3)) defines sends-stopped as true if and only if there exists an element S of Sndrs such that

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

contains set_stopped_t().

However, no declaration named Env is in scope at this point. state-type is specified in the context of make-state<Rcvr>::operator()<Sndrs...>; the relevant named template parameters there are Rcvr and Sndrs.... Env is a template parameter of check-types<Sndr, Env...>, which is a separate member function whose scope does not extend into make-state.

Other environment-dependent wording within the make-state scope uses env_of_t<Rcvr>:

The sends-stopped definition in bullet (15.3) is the only use of bare Env in this scope.

This issue was introduced by P3887R1 ("Make when_all a Ronseal Algorithm"), whose wording contains the same text.

Proposed resolution:

This wording is relative to N5046.

  1. Modify 33.9.12.12 [exec.when.all] as indicated:

    -15- The member void state-type::complete(Rcvr& rcvr) noexcept behaves as follows:

    1. (15.1) — If disp is equal to disposition::started, evaluates: […]

    2. (15.2) — Otherwise, if disp is equal to disposition::error, evaluates: […]

    3. (15.3) — Otherwise, evaluates:

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

      where sends-stopped equals true if and only if there exists an element S of Sndrs such that completion_signatures_of_t<S, when-all-env<Envenv_of_t<Rcvr>>> contains set_stopped_t().