|
| 1 | +<?xml version='1.0' encoding='utf-8' standalone='no'?> |
| 2 | +<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
| 3 | + |
| 4 | +<issue num="4438" status="New"> |
| 5 | +<title>Bad expression in [exec.when.all]</title> |
| 6 | +<section><sref ref="[exec.when.all]"/></section> |
| 7 | +<submitter>Eric Niebler</submitter> |
| 8 | +<date>30 Oct 2025</date> |
| 9 | +<priority>99</priority> |
| 10 | + |
| 11 | +<discussion> |
| 12 | +<p> |
| 13 | +<sref ref="[exec.when.all]"/> p5 reads as follows: |
| 14 | +</p> |
| 15 | +<blockquote style="border-left: 3px solid #ccc;padding-left: 15px;"> |
| 16 | +<p> |
| 17 | +-5- Let <tt><i>make-when-all-env</i></tt> be the following exposition-only function template: |
| 18 | +</p> |
| 19 | +<blockquote> |
| 20 | +<pre> |
| 21 | +template<class Env> |
| 22 | + constexpr auto <i>make-when-all-env</i>(inplace_stop_source& stop_src, <i>// exposition only</i> |
| 23 | + Env&& env) noexcept { |
| 24 | + return <i>see below</i>; |
| 25 | +} |
| 26 | +</pre> |
| 27 | +</blockquote> |
| 28 | +<p> |
| 29 | +Returns an object `e` such that |
| 30 | +</p> |
| 31 | +<ul style="list-style-type: none"> |
| 32 | +<li>(5.1) — `decltype(e)` models <tt><i>queryable</i></tt>, and |
| 33 | +</li> |
| 34 | +<li>(5.2) — `e.query(get_stop_token)` is expression-equivalent to <tt>state.<i>stop-src</i>.get_token()</tt>, |
| 35 | +and |
| 36 | +</li> |
| 37 | +<li>(5.3) — given a query object `q` with type other than <i>cv</i> `stop_token_t` and whose type |
| 38 | +satisfies <tt><i>forwarding-query</i></tt>, `e.query(q)` is expression-equivalent to `get_env(rcvr).query(q)`. |
| 39 | +</li> |
| 40 | +</ul> |
| 41 | + |
| 42 | +</blockquote> |
| 43 | +<p> |
| 44 | +The problem is with "<tt>state.<i>stop-src</i>.get_token()</tt>" in bullet (5.2). There is no `state` |
| 45 | +object here. This expression should be `stop_src.get_token()`. |
| 46 | +</p> |
| 47 | +</discussion> |
| 48 | + |
| 49 | +<resolution> |
| 50 | +<p> |
| 51 | +This wording is relative to <paper num="N5014"/>. |
| 52 | +</p> |
| 53 | + |
| 54 | +<ol> |
| 55 | + |
| 56 | +<li><p>Modify <sref ref="[exec.when.all]"/> as indicated:</p> |
| 57 | + |
| 58 | +<blockquote> |
| 59 | +<p> |
| 60 | +-5- Let <tt><i>make-when-all-env</i></tt> be the following exposition-only function template: |
| 61 | +</p> |
| 62 | +<blockquote> |
| 63 | +<pre> |
| 64 | +template<class Env> |
| 65 | + constexpr auto <i>make-when-all-env</i>(inplace_stop_source& stop_src, <i>// exposition only</i> |
| 66 | + Env&& env) noexcept { |
| 67 | + return <i>see below</i>; |
| 68 | +} |
| 69 | +</pre> |
| 70 | +</blockquote> |
| 71 | +<p> |
| 72 | +Returns an object `e` such that |
| 73 | +</p> |
| 74 | +<ul style="list-style-type: none"> |
| 75 | +<li>(5.1) — `decltype(e)` models <tt><i>queryable</i></tt>, and |
| 76 | +</li> |
| 77 | +<li>(5.2) — `e.query(get_stop_token)` is expression-equivalent to <tt><del>state.<i>stop-src</i></del><ins>stop_src</ins>.get_token()</tt>, |
| 78 | +and |
| 79 | +</li> |
| 80 | +<li>(5.3) — given a query object `q` with type other than <i>cv</i> `stop_token_t` and whose type |
| 81 | +satisfies <tt><i>forwarding-query</i></tt>, `e.query(q)` is expression-equivalent to `get_env(rcvr).query(q)`. |
| 82 | +</li> |
| 83 | +</ul> |
| 84 | +</blockquote> |
| 85 | +</li> |
| 86 | +</ol> |
| 87 | + |
| 88 | +</resolution> |
| 89 | + |
| 90 | +</issue> |
0 commit comments