|
| 1 | +<?xml version='1.0' encoding='utf-8' standalone='no'?> |
| 2 | +<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
| 3 | + |
| 4 | +<issue num="4340" status="New"> |
| 5 | +<title><code>task::promise_type::unhandled_stopped()</code> should be <code>noexcept</code></title> |
| 6 | +<section><sref ref="[task.promise]"/></section> |
| 7 | +<submitter>Dietmar Kühl</submitter> |
| 8 | +<date>31 Aug 2025</date> |
| 9 | +<priority>99</priority> |
| 10 | + |
| 11 | +<discussion> |
| 12 | +<p> |
| 13 | +The function <code>task::promise_type::unhandled_stopped()</code> |
| 14 | +is called from <code>set_stopped()</code> of a receiver and calls |
| 15 | +<code>set_stopped</code> itself. These functions are required to |
| 16 | +be <code>noexcept</code>. Thus, <code>unhandled_stopped()</code> |
| 17 | +can't throw an exception and should be marked <code>noexcept</code>. |
| 18 | +All other declarations of <code>unhandled_stopped()</code> are |
| 19 | +already marked <code>noexcept</code> but |
| 20 | +<code>task::promise_type::unhandled_stopped()</code> isn't. |
| 21 | +</p> |
| 22 | +</discussion> |
| 23 | + |
| 24 | +<resolution> |
| 25 | +<p> |
| 26 | +In the synopsis in <sref ref="[task.promise]"/> add <code>noexcept</code> |
| 27 | +to the declaration of <code>task::promise_type::unhandled_stopped()</code>: |
| 28 | +<blockquote><pre> |
| 29 | +namespace std::execution { |
| 30 | + template<class T, class Environment> |
| 31 | + class task<T, Environment>::promise_type { |
| 32 | + ... |
| 33 | + coroutine_handle<> unhandled_stopped() <ins>noexcept</ins>; |
| 34 | + ... |
| 35 | + }; |
| 36 | +} |
| 37 | +</pre></blockquote> |
| 38 | +</p> |
| 39 | +<p> |
| 40 | +In the specification in <sref ref="[task.promise]"/> paragraph 13 add <code>noexcept</code>: |
| 41 | +<blockquote> |
| 42 | +<pre> |
| 43 | +coroutine_handle<> unhandled_stopped() <ins>noexcept</ins>; |
| 44 | +</pre> |
| 45 | +<p>-13- <i>Effects</i>: Completes the asynchronous operation |
| 46 | +associated with <code><i>STATE</i>(*this)</code> by invoking |
| 47 | +<code>set_stopped(std::move(<i>RCVR</i>(*this)))</code>.</p> |
| 48 | +</blockquote> |
| 49 | +</p> |
| 50 | +</resolution> |
| 51 | + |
| 52 | +</issue> |
0 commit comments