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.

4340. task::promise_type::unhandled_stopped() should be noexcept

Section: 33.13.6.5 [task.promise] Status: New Submitter: Dietmar Kühl Opened: 2025-08-31 Last modified: 2025-09-01

Priority: Not Prioritized

View other active issues in [task.promise].

View all other issues in [task.promise].

View all issues with New status.

Discussion:

The function task::promise_type::unhandled_stopped() is called from set_stopped() of a receiver and calls set_stopped itself. These functions are required to be noexcept. Thus, unhandled_stopped() can't throw an exception and should be marked noexcept. All other declarations of unhandled_stopped() are already marked noexcept but task::promise_type::unhandled_stopped() isn't.

Proposed resolution:

In the synopsis in 33.13.6.5 [task.promise] add noexcept to the declaration of task::promise_type::unhandled_stopped():

namespace std::execution {
  template<class T, class Environment>
  class task<T, Environment>::promise_type {
     ...
    coroutine_handle<> unhandled_stopped() noexcept;
    ...
  };
}

In the specification in 33.13.6.5 [task.promise] paragraph 13 add noexcept:

coroutine_handle<> unhandled_stopped() noexcept;

-13- Effects: Completes the asynchronous operation associated with STATE(*this) by invoking set_stopped(std::move(RCVR(*this))).