Title
task needs get_completion_signatures()
Status
ready
Section
[task.class]
Submitter
Dietmar Kühl

Created on 2026-02-21.00:00:00 last changed 1 week ago

Messages

Date: 2026-02-27.16:05:19

Proposed resolution:

This wording is relative to N5032.

  1. Change the task synopsis in [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 [task.class] paragraph 4 (the specification moves to [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 [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().

Date: 2026-02-15.00:00:00

[ 2026-02-27; Reflector poll. ]

Set status to Tentatively Ready after 6 votes in favour during reflector poll.

Date: 2026-02-21.00:00:00

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.

History
Date User Action Args
2026-02-27 16:05:19adminsetmessages: + msg15983
2026-02-27 16:05:19adminsetstatus: new -> ready
2026-02-22 08:36:20adminsetmessages: + msg15973
2026-02-21 00:00:00admincreate