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.

4568. std::execution::spawn_future is mishandling dependent senders

Section: 33.9.12.18 [exec.spawn.future] Status: New Submitter: Eric Niebler Opened: 2026-04-11 Last modified: 2026-04-11

Priority: Not Prioritized

View all other issues in [exec.spawn.future].

View all issues with New status.

Discussion:

In 33.9.12.18 [exec.spawn.future] p7, we see this:

-7- Let spawn-future-state be the exposition-only class template:

namespace std::execution {
  template<class Alloc, scope_token Token, sender Sender, class Env>
  struct spawn-future-state                   // exposition only
    : spawn-future-state-base<completion_signatures_of_t<future-spawned-sender<Sender, Env>>> {
    using sigs-t =                            // exposition only
      completion_signatures_of_t<future-spawned-sender<Sender, Env>>;
    using receiver-t =                        // exposition only
      spawn-future-receiver<sigs-t>;
    using op-t =                              // exposition only
      connect_result_t<future-spawned-sender<Sender, Env>, receiver-t>;
  […]
  };
[…]
}

where spawn-future-sender<Sender, Env> is the type of write_env(stop-when(declval<Sender>(), declval<stoken-t>()), declval<Env>()).

The problem happens in the definition of sigs-t. There is a difference between asking for a sender's completion signatures with an empty environment, and asking with no environment.

In sigs-t, we are asking for the completion signatures with no environment. That is asking the sender for its non-dependent completions. But if Sender is a dependent sender, then so is future-spawned-sender<Sender, Env>, and so this line will not compile. A dependent sender cannot provide non-dependent completion signatures.

The spawn_future algorithm connects the future-spawned-sender with a receiver that has an empty environment. Therefore, we should be using the empty environment when computing the future-spawned-sender's completion signatures.

Proposed resolution:

This wording is relative to N5032.

  1. Modify 33.9.12.18 [exec.spawn.future] as indicated:

    -7- Let spawn-future-state be the exposition-only class template:

    namespace std::execution {
      template<class Alloc, scope_token Token, sender Sender, class Env>
      struct spawn-future-state                   // exposition only
        : spawn-future-state-base<completion_signatures_of_t<future-spawned-sender<Sender, Env>, env<>>> {
        using sigs-t =                            // exposition only
          completion_signatures_of_t<future-spawned-sender<Sender, Env>, env<>>;
        using receiver-t =                        // exposition only
          spawn-future-receiver<sigs-t>;
        using op-t =                              // exposition only
          connect_result_t<future-spawned-sender<Sender, Env>, receiver-t>;
      […]
      };
    […]
    }