Commit 9bce1ba
committed
fun_receiver: set_value(Ts...) => set_value(Ts&&...)
Sending completion signals to receivers must not throw, including
set_value. This is enforced as can be seen in this error which was
observed before the application of this commit:
/stdexec/__detail/__receivers.hpp:47:11: error: static assertion failed: set_value member functions must be noexcept
47 | noexcept(static_cast<_Receiver&&>(__rcvr).set_value(static_cast<_As&&>(__as)...)),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An obvious consequence of the above is that the set_value member
function(s) of a receiver must be marked noexcept. However the
evaluation of a function itself is not the only thing that can throw
when invoking a function: The population of the parameters thereto may
emit an exception. For example a function may accept parameters by value
thereby requiring the caller to copy or move the arguments thereto.
Since, as alluded to above, the parameters are populated in the context
of the caller the only thing a function can do to prevent such
exceptions is to accept its parameters by reference (thereby obviating
the need to move construct arguments thereto). Previously the test
helper fun_receiver did not do this leading to the error provided above.
Updated fun_receiver::set_value to accept parameters by forwarding
reference thereby allowing it to accept parameters whose move
constructors are not noexcept.1 parent 3a155e1 commit 9bce1ba
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| |||
0 commit comments