Skip to content

Commit cf2156a

Browse files
committed
New issue from Lewis Baker: "connect-awaitable() should mandate rcvr can receive all completion-signals rather than using constraints"
1 parent 7803838 commit cf2156a

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

xml/issue4355.xml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4355" status="New">
5+
<title><tt><i>connect-awaitable()</i></tt> should mandate `rcvr` can receive all completion-signals rather than using constraints</title>
6+
<section>
7+
<sref ref="[exec.connect]"/>
8+
</section>
9+
<submitter>Lewis Baker</submitter>
10+
<date>27 Aug 2025</date>
11+
<priority>99</priority>
12+
13+
<discussion>
14+
<p>
15+
In <sref ref="[exec.connect]"/> p6, the wording for the `connect()` customization-point defines a case that is
16+
expression-equivalent to <tt><i>connect-awaitable</i>(new_sndr, rcvr)</tt>.
17+
<p/>
18+
The <tt><i>connect-awaitable</i></tt> function is specified in p5 as having the signature:
19+
</p>
20+
<blockquote><pre>
21+
<i>operation-state-task</i> <i>connect-awaitable</i>(DS sndr, DR rcvr) requires receiver_of&lt;DR, Sigs&gt;;
22+
</pre></blockquote>
23+
<p>
24+
The requires-clause constrains this overload to ensure that the receiver, `rcvr`, can accept all of the
25+
completion signatures listed in `Sigs`. This means that `connect()` will SFINAE out if the receiver cannot
26+
accept all of the completion signatures, rather than this being ill-formed.
27+
<p/>
28+
However, this seems inconsistent with the handling of the case that dispatches to <tt>new-sndr.connect(rcvr)</tt>
29+
which does not constrain on this. It is also redundant with the <i>Mandates</i> element in p6 which mandates
30+
that the following is satisfied:
31+
</p>
32+
<blockquote><pre>
33+
receiver_of&lt;Rcvr, completion_signatures_of_t&lt;Sndr, env_of_t&lt;Rcvr&gt;&gt;&gt;
34+
</pre></blockquote>
35+
<p>
36+
The constraint on <tt><i>connect-awaitable</i></tt> should either be removed or replaced with a
37+
<i>Mandates</i> element. As <tt><i>connect-awaitable</i></tt> is only used within the definition of
38+
<tt>connect()</tt> and as <tt>connect()</tt> already mandates that `receiver_of` is satisfied,
39+
it seems sufficient to just remove this constraint from <tt><i>connect-awaitable</i></tt>.
40+
</p>
41+
</discussion>
42+
43+
<resolution>
44+
<p>
45+
This wording is relative to <paper num="N5014"/>.
46+
</p>
47+
48+
<ol>
49+
50+
<li><p>Modify <sref ref="[exec.connect]"/> as indicated:</p>
51+
52+
<blockquote>
53+
<p>
54+
-5- Let `V` name the type <tt><i>await-result-type</i>&lt;DS, <i>connect-awaitable-promise</i>&gt;</tt>,
55+
let `Sigs` name the type
56+
</p>
57+
<blockquote><pre>
58+
completion_signatures&lt;
59+
<i>SET-VALUE-SIG</i>(V), // <i>see <sref ref="[exec.snd.concepts]"/></i>
60+
set_error_t(exception_ptr),
61+
set_stopped_t()&gt;
62+
</pre></blockquote>
63+
<p>
64+
and let <tt><i>connect-awaitable</i></tt> be an exposition-only coroutine defined as follows:
65+
</p>
66+
<blockquote><pre>
67+
namespace std::execution {
68+
[&hellip;]
69+
<i>operation-state-task</i> <i>connect-awaitable</i>(DS sndr, DR rcvr) <del>requires receiver_of&lt;DR, Sigs&gt;</del> {
70+
exception_ptr ep;
71+
try {
72+
if constexpr (same_as&lt;V, void&gt;) {
73+
co_await std::move(sndr);
74+
co_await <i>suspend-complete</i>(set_value, std::move(rcvr));
75+
} else {
76+
co_await <i>suspend-complete</i>(set_value, std::move(rcvr), co_await std::move(sndr));
77+
}
78+
} catch(...) {
79+
ep = current_exception();
80+
}
81+
co_await <i>suspend-complete</i>(set_error, std::move(rcvr), std::move(ep));
82+
}
83+
}
84+
</pre></blockquote>
85+
<p>
86+
</p>
87+
</blockquote>
88+
89+
</li>
90+
91+
</ol>
92+
</resolution>
93+
94+
</issue>

0 commit comments

Comments
 (0)