Skip to content

Commit 52013d7

Browse files
committed
New issue from Robert A.H. Leahy: "write_env implementation-detail lambda should have explicit return type"
1 parent c3264aa commit 52013d7

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

xml/issue4395.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4395" status="New">
5+
<title>`write_env` implementation-detail lambda should have explicit return type</title>
6+
<section><sref ref="[exec.write.env]"/></section>
7+
<submitter>Robert A.H. Leahy</submitter>
8+
<date>29 Sep 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
In <sref ref="[exec.write.env]"/> the impls for `std::execution::write_env` has <tt><i>get-env</i></tt>
14+
specified as:
15+
</p>
16+
<blockquote><pre>
17+
static constexpr auto <i>get-env</i> =
18+
[](auto, const auto&amp; state, const auto&amp; rcvr) noexcept {
19+
return <i>see-below</i>;
20+
};
21+
</pre></blockquote>
22+
<p>
23+
This uses automatic return type deduction which means that the body of the lambda is actually instantiated
24+
in a SFINAE-unfriendly way when attempting to compute various properties of the lambda (invocability,
25+
return type, et cetera). This is undesirable and surprising as has been discovered in actual use/deployment
26+
(see: <a href="https://github.com/NVIDIA/stdexec/pull/1654">https://github.com/NVIDIA/stdexec/pull/1654</a>).
27+
<p/>
28+
The fix is to explicitly provide a return type for the lambda which computes the type of the body.
29+
<p/>
30+
Note: This issue may indicate that the use of automatic return type deduction in the specification of
31+
sender algorithms more generally ought to be reconsidered/-examined.
32+
</p>
33+
</discussion>
34+
35+
<resolution>
36+
</resolution>
37+
38+
</issue>

0 commit comments

Comments
 (0)