|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta charset="utf-8"> |
| 5 | +<title>Issue 4227: Missing noexcept operator in [exec.when.all]</title> |
| 6 | +<meta property="og:title" content="Issue 4227: Missing noexcept operator in [exec.when.all]"> |
| 7 | +<meta property="og:description" content="C++ library issue. Status: New"> |
| 8 | +<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4227.html"> |
| 9 | +<meta property="og:type" content="website"> |
| 10 | +<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png"> |
| 11 | +<meta property="og:image:alt" content="C++ logo"> |
| 12 | +<style> |
| 13 | + p {text-align:justify} |
| 14 | + li {text-align:justify} |
| 15 | + pre code.backtick::before { content: "`" } |
| 16 | + pre code.backtick::after { content: "`" } |
| 17 | + blockquote.note |
| 18 | + { |
| 19 | + background-color:#E0E0E0; |
| 20 | + padding-left: 15px; |
| 21 | + padding-right: 15px; |
| 22 | + padding-top: 1px; |
| 23 | + padding-bottom: 1px; |
| 24 | + } |
| 25 | + ins {background-color:#A0FFA0} |
| 26 | + del {background-color:#FFA0A0} |
| 27 | + table.issues-index { border: 1px solid; border-collapse: collapse; } |
| 28 | + table.issues-index th { text-align: center; padding: 4px; border: 1px solid; } |
| 29 | + table.issues-index td { padding: 4px; border: 1px solid; } |
| 30 | + table.issues-index td:nth-child(1) { text-align: right; } |
| 31 | + table.issues-index td:nth-child(2) { text-align: left; } |
| 32 | + table.issues-index td:nth-child(3) { text-align: left; } |
| 33 | + table.issues-index td:nth-child(4) { text-align: left; } |
| 34 | + table.issues-index td:nth-child(5) { text-align: center; } |
| 35 | + table.issues-index td:nth-child(6) { text-align: center; } |
| 36 | + table.issues-index td:nth-child(7) { text-align: left; } |
| 37 | + table.issues-index td:nth-child(5) span.no-pr { color: red; } |
| 38 | + @media (prefers-color-scheme: dark) { |
| 39 | + html { |
| 40 | + color: #ddd; |
| 41 | + background-color: black; |
| 42 | + } |
| 43 | + ins { |
| 44 | + background-color: #225522 |
| 45 | + } |
| 46 | + del { |
| 47 | + background-color: #662222 |
| 48 | + } |
| 49 | + a { |
| 50 | + color: #6af |
| 51 | + } |
| 52 | + a:visited { |
| 53 | + color: #6af |
| 54 | + } |
| 55 | + blockquote.note |
| 56 | + { |
| 57 | + background-color: rgba(255, 255, 255, .10) |
| 58 | + } |
| 59 | + } |
| 60 | +</style> |
| 61 | +</head> |
| 62 | +<body> |
| 63 | +<hr> |
| 64 | +<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p> |
| 65 | +<h3 id="4227"><a href="lwg-active.html#4227">4227</a>. Missing <code class='backtick'>noexcept</code> operator in [exec.when.all]</h3> |
| 66 | +<p><b>Section:</b> 33.9.12.11 <a href="https://wg21.link/exec.when.all">[exec.when.all]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a> |
| 67 | + <b>Submitter:</b> Ian Petersen <b>Opened:</b> 2025-03-17 <b>Last modified:</b> 2025-03-22</p> |
| 68 | +<p><b>Priority: </b>Not Prioritized |
| 69 | +</p> |
| 70 | +<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p> |
| 71 | +<p><b>Discussion:</b></p> |
| 72 | +<p> |
| 73 | +In 33.9.12.11 <a href="https://wg21.link/exec.when.all">[exec.when.all]</a> p7, the <code><i>impls-for</i><when_all_t>::<i>get-state</i></code> |
| 74 | +member is defined to be equivalent to the following lambda: |
| 75 | +</p> |
| 76 | +<blockquote><pre> |
| 77 | +[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(<i>e</i>) -> decltype(<i>e</i>) { |
| 78 | + return <i>e</i>; |
| 79 | +} |
| 80 | +</pre></blockquote> |
| 81 | +<p> |
| 82 | +and <code><i>e</i></code> is later defined to be: |
| 83 | +</p> |
| 84 | +<blockquote><pre> |
| 85 | +std::forward<Sndr>(sndr).apply(<i>make-state</i><Rcvr>()) |
| 86 | +</pre></blockquote> |
| 87 | +<p> |
| 88 | +Together, the two definitions imply that the <code class='backtick'>noexcept</code> clause on the provided lambda is: |
| 89 | +</p> |
| 90 | +<blockquote><pre> |
| 91 | +noexcept(std::forward<Sndr>(sndr).apply(<i>make-state</i><Rcvr>())) |
| 92 | +</pre></blockquote> |
| 93 | +<p> |
| 94 | +which is invalid. |
| 95 | +<p/> |
| 96 | +Presumably, the lambda should be defined like so (with an extra <code class='backtick'>noexcept</code> operator in the <code class='backtick'>noexcept</code> clause): |
| 97 | +</p> |
| 98 | +<blockquote><pre> |
| 99 | +[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(<ins>noexcept(</ins><i>e</i><ins>)</ins>) -> decltype(<i>e</i>) { |
| 100 | + return <i>e</i>; |
| 101 | +} |
| 102 | +</pre></blockquote> |
| 103 | + |
| 104 | + |
| 105 | +<p id="res-4227"><b>Proposed resolution:</b></p> |
| 106 | +<p> |
| 107 | +This wording is relative to <a href="https://wg21.link/N5008">N5008</a>. |
| 108 | +</p> |
| 109 | + |
| 110 | +<ol> |
| 111 | + |
| 112 | +<li><p>Modify 33.9.12.11 <a href="https://wg21.link/exec.when.all">[exec.when.all]</a> as indicated:</p> |
| 113 | + |
| 114 | +<blockquote> |
| 115 | +<p> |
| 116 | +-7- The member <code><i>impls-for</i><when_all_t>::<i>get-state</i></code> is initialized with a callable object |
| 117 | +equivalent to the following lambda expression: |
| 118 | +</p> |
| 119 | +<blockquote><pre> |
| 120 | +[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(<ins>noexcept(</ins><i>e</i><ins>)</ins>) -> decltype(<i>e</i>) { |
| 121 | + return <i>e</i>; |
| 122 | +} |
| 123 | +</pre></blockquote> |
| 124 | +</blockquote> |
| 125 | +</li> |
| 126 | + |
| 127 | +</ol> |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | +</body> |
| 134 | +</html> |
0 commit comments