Skip to content

CWG2556 [stmt.return.coroutine] Unusable promise::return_void #22

@opensdh

Description

@opensdh

Reference (section label)

[stmt.return.coroutine]

Link to reflector thread (if any)

https://lists.isocpp.org/core/2020/09/9958.php

Issue description

The note in [dcl.fct.def.coroutine]/6 suggests that the existence of promise::return_void causes flowing off the end of a coroutine to be well-defined. [stmt.return.coroutine]/3, however, actually checks whether calling it with no arguments is a valid expression (presumably from the coroutine). As such, a return_void that is inaccessible, deleted, or requires arguments will produce undefined behavior even though the implementation knows that return_void was "intended" (since no return_value can coexist with it). This seems unnecessarily user-hostile.

Suggested resolution

Say in [stmt.return.coroutine]/3 that p.return_void() is used if name lookup succeeded even if it's ill-formed.

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