Skip to content

Commit 242d10b

Browse files
authored
New issue from Dietmar Kühl: task::promise_type::unhandled_stopped() should be noexcept
1 parent 8ff6942 commit 242d10b

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

xml/issue4340.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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&lt;class T, class Environment&gt;
31+
class task&lt;T, Environment&gt;::promise_type {
32+
...
33+
coroutine_handle&lt;&gt; 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&lt;&gt; 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

Comments
 (0)