<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 4143: execution::set_value/set_error/set_stopped/start should always return void</title>
<meta property="og:title" content="Issue 4143: execution::set_value/set_error/set_stopped/start should always return void">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4143.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<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>
<h3 id="4143"><a href="lwg-active.html#4143">4143</a>. <code>execution::set_value/set_error/set_stopped/start</code> should always return <code>void</code></h3>
<p><b>Section:</b> 33.7.2 <a href="https://wg21.link/exec.set.value">[exec.set.value]</a>, 33.7.3 <a href="https://wg21.link/exec.set.error">[exec.set.error]</a>, 33.7.4 <a href="https://wg21.link/exec.set.stopped">[exec.set.stopped]</a>, 33.8.2 <a href="https://wg21.link/exec.opstate.start">[exec.opstate.start]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Jiang An <b>Opened:</b> 2024-08-20 <b>Last modified:</b> 2024-09-18</p>
<p><b>Priority: </b>2
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
In editorial issue <a href="https://github.com/cplusplus/draft/issues/7222">#7222</a>,
it was observed that currently <code>execution::start</code> may have a non-<code>void</code>
return value, which possibly interacts with overloaded <code>operator,</code>. But the
return value of <code>execution::start</code> doesn't seem used anywhere.
<p/>
In addition to <code>execution::start</code>, the return values of <code>execution::set_value</code>,
<code>execution::set_error</code>, and <code>execution::set_stopped</code> also seem never used,
and the return type of these CPOs are always <code>void</code> in
<a href="https://github.com/NVIDIA/stdexec">stdexec</a>. Perhaps it would be better to
specified in the standard that these CPOs always return <code>void</code>.
</p>

<p><i>[2024-09-18; Reflector poll]</i></p>

<p>
Set priority to 2 after reflector poll.
Should require the expressions to have type <code class='backtick'>void</code>,
rather than just discarding anything that is returned.
</p>



<p id="res-4143"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/N4988" title=" Working Draft, Programming Languages — C++">N4988</a>.
</p>

<ol>
<li><p>Modify 33.7.2 <a href="https://wg21.link/exec.set.value">[exec.set.value]</a> as indicated:</p>

<blockquote>
<p>
-1- <code>set_value</code> is a value completion function (33.3 <a href="https://wg21.link/exec.async.ops">[exec.async.ops]</a>).
Its associated completion tag is <code>set_value_t</code>. The expression <code>set_value(rcvr, vs...)</code>
for a subexpression <code>rcvr</code> and pack of subexpressions <code>vs</code> is ill-formed if
<code>rcvr</code> is an lvalue or an rvalue of const type. Otherwise, it is expression-equivalent to
<code><i>MANDATE-NOTHROW</i>(<ins>void(</ins>rcvr.set_value(vs...)<ins>)</ins>)</code>.
</p>
</blockquote>
</li>

<li><p>Modify 33.7.3 <a href="https://wg21.link/exec.set.error">[exec.set.error]</a> as indicated:</p>

<blockquote>
<p>
-1- <code>set_error</code> is an error completion function (33.3 <a href="https://wg21.link/exec.async.ops">[exec.async.ops]</a>).
Its associated completion tag is <code>set_error_t</code>. The expression <code>set_error(rcvr, err)</code>
for some subexpressions <code>rcvr</code> and <code>err</code> is ill-formed if <code>rcvr</code> is an
lvalue or an rvalue of const type. Otherwise, it is expression-equivalent to
<code><i>MANDATE-NOTHROW</i>(<ins>void(</ins>rcvr.set_error(err)<ins>)</ins>)</code>.
</p>
</blockquote>
</li>

<li><p>Modify 33.7.4 <a href="https://wg21.link/exec.set.stopped">[exec.set.stopped]</a> as indicated:</p>

<blockquote>
<p>
-1- <code>set_stopped</code> is a stopped completion function (33.3 <a href="https://wg21.link/exec.async.ops">[exec.async.ops]</a>).
Its associated completion tag is <code>set_stopped_t</code>. The expression <code>set_stopped(rcvr)</code>
for a subexpression <code>rcvr</code> is ill-formed if <code>rcvr</code> is an lvalue or an rvalue of
const type. Otherwise, it is expression-equivalent to
<code><i>MANDATE-NOTHROW</i>(<ins>void(</ins>rcvr.set_stopped()<ins>)</ins>)</code>.
</p>
</blockquote>
</li>

<li><p>Modify 33.8.2 <a href="https://wg21.link/exec.opstate.start">[exec.opstate.start]</a> as indicated:</p>

<blockquote>
<p>
-1- The name <code>start</code> denotes a customization point object that starts (33.3 <a href="https://wg21.link/exec.async.ops">[exec.async.ops]</a>)
the asynchronous operation associated with the operation state object. For a subexpression <code>op</code>,
the expression <code>start(op)</code> is ill-formed if <code>op</code> is an rvalue. Otherwise, it is
expression-equivalent to <code><i>MANDATE-NOTHROW</i>(<ins>void(</ins>op.start()<ins>)</ins>)</code>.
</p>
</blockquote>
</li>
</ol>






</body>
</html>
