Skip to content

error types should be nothrow-movable #115

Open
@ericniebler

Description

@ericniebler

Issue by lucteo
Sunday Nov 28, 2021 at 17:08 GMT
Originally opened as NVIDIA/stdexec#284


Given:

  • P2300R2 description of the set_error() CPO doesn't make any reference to whether set_error() can throw or not (9.4.2). The text implies that noexcept is forwarded to the actual implementation (most probably by the receiver objects)
  • The receiver concept specification (9.4) defines the set_error() CPO as noexcept
  • The let_error() specification allows the type E to throw in move construct
  • The let_error() implementation example (9.6.4.5) implies that set_error(E) can throw (and a subsequent set_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 the E type can throw while being moved, then:

  • as implementation show, we need a try/catch around the call to set_error()
  • the sender construction can throw (as the error value is moved)
  • the operation state can throw when constructed (i.e., when connect is called)

Again, the receiver connected to the operation state of let_error() doesn't allow set_error(E) to throw

Wouldn'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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0designdiscussionWe need to talk about this; there's nothing actionable here yetprocessedprocessed in a meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions