Skip to content

CWG2935 [dcl.fct.def.coroutine] Destroying the coroutine state when initial-await-resume-called is false #575

Open
@t3nsor

Description

@t3nsor

Full name of submitter: Brian Bi

Reference (section label): [dcl.fct.def.coroutine]

Issue description: According to [dcl.fct.def.coroutine]/11, the coroutine state is destroyed only when "control flows off the end" or when .destroy() is called on a coroutine handle.

In [dcl.fct.def.coroutine]/5, suppose that an exception occurs at any point before initial-await-resume-called becomes true. Then [dcl.fct.def.coroutine]/11 does not state that the coroutine state is destroyed, nor does anything in this section state that the coroutine is suspended. Consequently, the caller is not able to destroy the coroutine state either and the coroutine state is leaked.

If the intent is to leak the coroutine state but still give the caller some means of observing the exception (e.g. log it and then terminate), this should be clarified in a note; otherwise, the implementation should either destroy the coroutine state or suspend the coroutine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions