4528. task needs get_completion_signatures()

Section: 33.13.6.2 [task.class] Status: New Submitter: Dietmar Kühl Opened: 2026-02-21 Last modified: 2026-02-22

Priority: Not Prioritized

View other active issues in [task.class].

View all other issues in [task.class].

View all issues with New status.

Discussion:

The changes made by P3164 mean that it isn't sufficient to have a completion_signatures type alias in the task class. Instead, it needs to have a static consteval get_completion_signatures() member function that returns the completion signatures. Instead of defining a type alias, the function can return the same type.

Proposed resolution:

This wording is relative to N5032.

  1. Change the task synopsis in 33.13.6.2 [task.class] to not have a completion_signatures type alias, but instead have a static consteval get_completion_signatures() member function that returns the completion signatures:

    namespace std::execution {
      template<class T = void, class Environment = env<>>
      class task {
        // [task.state]
        template<receiver Rcvr>
          class state;                              // exposition only
    
      public:
        using sender_concept = sender_t;
        using completion_signatures = see below;
        using allocator_type = see below;
        using scheduler_type = see below;
        using stop_source_type = see below;
        using stop_token_type = decltype(declval<stop_source_type>().get_token());
        using error_types = see below;
    
        // [task.promise]
        class promise_type;
    
        task(task&&) noexcept;
        ~task();
    
        template<class Self, class... Env>
          static consteval auto get_completion_signatures();
    
        template<receiver Rcvr>
          state<Rcvr> connect(Rcvr&& rcvr) &&;
    
      private:
        coroutine_handle<promise_type> handle;      // exposition only
      };
    }
    
  2. Remove 33.13.6.2 [task.class] paragraph 4 (the specification moves to 33.13.6.3 [task.members]):

    -4- The type alias completion_signatures is a specialization of execution::completion_signatures with the template arguments (in unspecified order):

    -4.1- -- set_value_t() if T is void, and set_value_t(T) otherwise;

    -4.2- -- template arguments of the specialization of execution::completion_signatures denoted by error_types; and

    -4.3- -- set_stopped_t().

  3. Add a new paragraph to 33.13.6.3 [task.members] before the specification of the connect member function, with the specification of the new get_completion_signatures member function:

    template<class Self, class... Env>
      static consteval auto get_completion_signatures();
    

    -?- Let the type C be a specialization of execution::completion_signatures with the template arguments (in unspecified order):

    -?.1- -- set_value_t() if T is void, and set_value_t(T) otherwise;

    -?.2- -- template arguments of the specialization of execution::completion_signatures denoted by error_types; and

    -?.3- -- set_stopped_t().

    -?- Returns: C().