Open ericniebler opened 10 months ago
Comment by lucteo Sunday Nov 28, 2021 at 17:34 GMT
Looking at the libunifex implementation (https://github.com/facebookexperimental/libunifex/blob/2547d87fb98a1fe70eccc170a8c91b144648517d/include/unifex/receiver_concepts.hpp), if the error type throws on move, then the program is ill formed. The set_error()
CPO is defined as noexcept, it doesn't constrain the error type to not throw, and allows the move constructor to be called on the given error.
Thus, the inner call to tag_invoke
may throw, without try/catch, inside a noexcept
function.
We should discuss about having this restriction in the set_error()
CPO.
i.e. that it mandates that the error type must be nothrow move-constructible.
Issue by lucteo Sunday Nov 28, 2021 at 17:08 GMT Originally opened as https://github.com/NVIDIA/stdexec/issues/284
Given:
set_error()
CPO doesn't make any reference to whetherset_error()
can throw or not (9.4.2). The text implies thatnoexcept
is forwarded to the actual implementation (most probably by the receiver objects)set_error()
CPO asnoexcept
let_error()
specification allows the typeE
to throw in move constructlet_error()
implementation example (9.6.4.5) implies thatset_error(E)
can throw (and a subsequentset_error()
is called with the caught exception).This seems confusing.
The only way that
set_error()
can throw inside the operation state is when the error type throws on move. If theE
type can throw while being moved, then:set_error()
connect
is called)Again, the receiver connected to the operation state of
let_error()
doesn't allowset_error(E)
to throwWouldn't it be better for the paper to specify that all error types are nothow-movable? The paper has this requirement in several places for other types. Adding this specification will make the implementation simpler and more coherent.