Skip to content

Commit 5cc76c5

Browse files
committed
New issue from Eric Niebler: "check-types function for upon_error and upon_stopped is wrong"
1 parent 15389ac commit 5cc76c5

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

xml/issue4369.xml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4369" status="New">
5+
<title><tt><i>check-types</i></tt> function for `upon_error` and `upon_stopped` is wrong</title>
6+
<section>
7+
<sref ref="[exec.then]"/>
8+
</section>
9+
<submitter>Eric Niebler</submitter>
10+
<date>31 Aug 2025</date>
11+
<priority>99</priority>
12+
13+
<discussion>
14+
<p>
15+
The following has been reported by Trevor Gray:
16+
</p>
17+
<p>
18+
In <sref ref="[exec.then]"/> p5, the <tt><i>impls-for</i>&lt;<i>decayed-typeof</i>&lt;<i>then-cpo</i>&gt;&gt;::<i>check-types</i></tt>
19+
unction is specified as follows:
20+
</p>
21+
<blockquote style="border-left: 3px solid #ccc;padding-left: 15px;">
22+
<pre>
23+
template&lt;class Sndr, class... Env&gt;
24+
static consteval void <i>check-types</i>();
25+
</pre>
26+
<blockquote>
27+
<p>
28+
<i>Effects</i>: Equivalent to:
29+
</p>
30+
<blockquote><pre>
31+
auto cs = get_completion_signatures&lt;<i>child-type</i>&lt;Sndr&gt;, <i>FWD-ENV-T</i>(Env)...&gt;();
32+
auto fn = []&lt;class... Ts&gt;(set_value_t(*)(Ts...)) {
33+
if constexpr (!invocable&lt;remove_cvref_t&lt;<i>data-type</i>&lt;Sndr&gt;&gt;, Ts...&gt;)
34+
throw <i>unspecified-exception</i>();
35+
};
36+
cs.<i>for-each</i>(<i>overload-set</i>{fn, [](auto){}});
37+
</pre></blockquote>
38+
<p>
39+
where <tt><i>unspecified-exception</i></tt> is a type derived from `exception`.
40+
</p>
41+
</blockquote>
42+
</blockquote>
43+
<p>
44+
The line <tt>auto fn = []&lt;class... Ts&gt;(set_value_t(*)(Ts...)) {</tt>
45+
is correct when <tt><i>then-cpo</i></tt> is `then` but not when it is `upon_error` or `upon_stopped`.
46+
<p/>
47+
For `upon_error` it should be:
48+
</p>
49+
<blockquote><pre>
50+
auto fn = []&lt;class... Ts&gt;(set_error_t(*)(Ts...)) {
51+
</pre></blockquote>
52+
<p>
53+
and for `upon_stopped` it should be:
54+
</p>
55+
<blockquote><pre>
56+
auto fn = []&lt;class... Ts&gt;(set_stopped_t(*)(Ts...)) {
57+
</pre></blockquote>
58+
<p>
59+
We can achieve that by replacing `set_value_t` in the problematic line with <tt><i>decayed-typeof</i>&lt;<i>set-cpo</i>&gt;</tt>.
60+
</p>
61+
</discussion>
62+
63+
<resolution>
64+
<p>
65+
This wording is relative to <paper num="N5014"/>.
66+
</p>
67+
68+
<ol>
69+
70+
<li><p>Modify <sref ref="[exec.then]"/> as indicated:</p>
71+
72+
<blockquote>
73+
<pre>
74+
template&lt;class Sndr, class... Env&gt;
75+
static consteval void <i>check-types</i>();
76+
</pre>
77+
<blockquote>
78+
<p>
79+
-5- <i>Effects:</i> Equivalent to:
80+
</p>
81+
<blockquote><pre>
82+
auto cs = get_completion_signatures&lt;<i>child-type</i>&lt;Sndr&gt;, <i>FWD-ENV-T</i>(Env)...&gt;();
83+
auto fn = []&lt;class... Ts&gt;(<del>set_value_t</del><ins><i>decayed-typeof</i>&lt;<i>set-cpo</i>&gt;</ins>(*)(Ts...)) {
84+
if constexpr (!invocable&lt;remove_cvref_t&lt;<i>data-type</i>&lt;Sndr&gt;&gt;, Ts...&gt;)
85+
throw <i>unspecified-exception</i>();
86+
};
87+
cs.<i>for-each</i>(<i>overload-set</i>{fn, [](auto){}});
88+
</pre></blockquote>
89+
<p>
90+
where <tt><i>unspecified-exception</i></tt> is a type derived from `exception`.
91+
</p>
92+
</blockquote>
93+
</blockquote>
94+
95+
</li>
96+
97+
</ol></resolution>
98+
99+
</issue>

0 commit comments

Comments
 (0)