|
| 1 | +<?xml version='1.0' encoding='utf-8' standalone='no'?> |
| 2 | +<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
| 3 | + |
| 4 | +<issue num="4227" status="New"> |
| 5 | +<title>Missing `noexcept` operator in [exec.when.all]</title> |
| 6 | +<section> |
| 7 | +<sref ref="[exec.when.all]"/> |
| 8 | +</section> |
| 9 | +<submitter>Ian Petersen</submitter> |
| 10 | +<date>17 Mar 2025</date> |
| 11 | +<priority>99</priority> |
| 12 | + |
| 13 | +<discussion> |
| 14 | +<p> |
| 15 | +In <sref ref="[exec.when.all]"/> p7, the <tt><i>impls-for</i><when_all_t>::<i>get-state</i></tt> |
| 16 | +member is defined to be equivalent to the following lambda: |
| 17 | +</p> |
| 18 | +<blockquote><pre> |
| 19 | +[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(<i>e</i>) -> decltype(<i>e</i>) { |
| 20 | + return <i>e</i>; |
| 21 | +} |
| 22 | +</pre></blockquote> |
| 23 | +<p> |
| 24 | +and <tt><i>e</i></tt> is later defined to be: |
| 25 | +</p> |
| 26 | +<blockquote><pre> |
| 27 | +std::forward<Sndr>(sndr).apply(<i>make-state</i><Rcvr>()) |
| 28 | +</pre></blockquote> |
| 29 | +<p> |
| 30 | +Together, the two definitions imply that the `noexcept` clause on the provided lambda is: |
| 31 | +</p> |
| 32 | +<blockquote><pre> |
| 33 | +noexcept(std::forward<Sndr>(sndr).apply(<i>make-state</i><Rcvr>())) |
| 34 | +</pre></blockquote> |
| 35 | +<p> |
| 36 | +which is invalid. |
| 37 | +<p/> |
| 38 | +Presumably, the lambda should be defined like so (with an extra `noexcept` operator in the `noexcept` clause): |
| 39 | +</p> |
| 40 | +<blockquote><pre> |
| 41 | +[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(<ins>noexcept(</ins><i>e</i><ins>)</ins>) -> decltype(<i>e</i>) { |
| 42 | + return <i>e</i>; |
| 43 | +} |
| 44 | +</pre></blockquote> |
| 45 | +</discussion> |
| 46 | + |
| 47 | +<resolution> |
| 48 | +<p> |
| 49 | +This wording is relative to <paper num="N5008"/>. |
| 50 | +</p> |
| 51 | + |
| 52 | +<ol> |
| 53 | + |
| 54 | +<li><p>Modify <sref ref="[exec.when.all]"/> as indicated:</p> |
| 55 | + |
| 56 | +<blockquote> |
| 57 | +<p> |
| 58 | +-7- The member <tt><i>impls-for</i><when_all_t>::<i>get-state</i></tt> is initialized with a callable object |
| 59 | +equivalent to the following lambda expression: |
| 60 | +</p> |
| 61 | +<blockquote><pre> |
| 62 | +[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(<ins>noexcept(</ins><i>e</i><ins>)</ins>) -> decltype(<i>e</i>) { |
| 63 | + return <i>e</i>; |
| 64 | +} |
| 65 | +</pre></blockquote> |
| 66 | +</blockquote> |
| 67 | +</li> |
| 68 | + |
| 69 | +</ol> |
| 70 | +</resolution> |
| 71 | + |
| 72 | +</issue> |
0 commit comments