4143. execution::set_value/set_error/set_stopped/start should always return void

Section: 33.7.2 [exec.set.value], 33.7.3 [exec.set.error], 33.7.4 [exec.set.stopped], 33.8.2 [exec.opstate.start] Status: New Submitter: Jiang An Opened: 2024-08-20 Last modified: 2024-09-18

Priority: 2

View all issues with New status.

Discussion:

In editorial issue #7222, it was observed that currently execution::start may have a non-void return value, which possibly interacts with overloaded operator,. But the return value of execution::start doesn't seem used anywhere.

In addition to execution::start, the return values of execution::set_value, execution::set_error, and execution::set_stopped also seem never used, and the return type of these CPOs are always void in stdexec. Perhaps it would be better to specified in the standard that these CPOs always return void.

[2024-09-18; Reflector poll]

Set priority to 2 after reflector poll. Should require the expressions to have type void, rather than just discarding anything that is returned.

Proposed resolution:

This wording is relative to N4988.

  1. Modify 33.7.2 [exec.set.value] as indicated:

    -1- set_value is a value completion function (33.3 [exec.async.ops]). Its associated completion tag is set_value_t. The expression set_value(rcvr, vs...) for a subexpression rcvr and pack of subexpressions vs is ill-formed if rcvr is an lvalue or an rvalue of const type. Otherwise, it is expression-equivalent to MANDATE-NOTHROW(void(rcvr.set_value(vs...))).

  2. Modify 33.7.3 [exec.set.error] as indicated:

    -1- set_error is an error completion function (33.3 [exec.async.ops]). Its associated completion tag is set_error_t. The expression set_error(rcvr, err) for some subexpressions rcvr and err is ill-formed if rcvr is an lvalue or an rvalue of const type. Otherwise, it is expression-equivalent to MANDATE-NOTHROW(void(rcvr.set_error(err))).

  3. Modify 33.7.4 [exec.set.stopped] as indicated:

    -1- set_stopped is a stopped completion function (33.3 [exec.async.ops]). Its associated completion tag is set_stopped_t. The expression set_stopped(rcvr) for a subexpression rcvr is ill-formed if rcvr is an lvalue or an rvalue of const type. Otherwise, it is expression-equivalent to MANDATE-NOTHROW(void(rcvr.set_stopped())).

  4. Modify 33.8.2 [exec.opstate.start] as indicated:

    -1- The name start denotes a customization point object that starts (33.3 [exec.async.ops]) the asynchronous operation associated with the operation state object. For a subexpression op, the expression start(op) is ill-formed if op is an rvalue. Otherwise, it is expression-equivalent to MANDATE-NOTHROW(void(op.start())).