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.
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.
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 isset_value_t
. The expressionset_value(rcvr, vs...)
for a subexpressionrcvr
and pack of subexpressionsvs
is ill-formed ifrcvr
is an lvalue or an rvalue of const type. Otherwise, it is expression-equivalent toMANDATE-NOTHROW(void(rcvr.set_value(vs...)))
.
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 isset_error_t
. The expressionset_error(rcvr, err)
for some subexpressionsrcvr
anderr
is ill-formed ifrcvr
is an lvalue or an rvalue of const type. Otherwise, it is expression-equivalent toMANDATE-NOTHROW(void(rcvr.set_error(err)))
.
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 isset_stopped_t
. The expressionset_stopped(rcvr)
for a subexpressionrcvr
is ill-formed ifrcvr
is an lvalue or an rvalue of const type. Otherwise, it is expression-equivalent toMANDATE-NOTHROW(void(rcvr.set_stopped()))
.
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 subexpressionop
, the expressionstart(op)
is ill-formed ifop
is an rvalue. Otherwise, it is expression-equivalent toMANDATE-NOTHROW(void(op.start()))
.