Skip to content

CWG3048 [stmt.expand] Zero "iterations" only possible for iterating and enumerating expansion statements #743

@jakubjelinek

Description

@jakubjelinek

Full name of submitter (unless configured in github; will be published with the issue): Jakub Jelinek

Reference (section label): stmt.expand

Link to reflector thread (if any):

Issue description: Right now both iterating and enumerating expansion statements can have zero "iterations", the former if begin is the same as end, the latter for {}. But for destructuring expansion statements, I believe it has to have at least one iteration, because a valid structured binding declaration needs to have at least one name. While with structured binding packs one can have zero, i.e. if ihttps://eel.is/c++draft/stmt.expand#5.3 was instead constexpropt auto&& [...u] = expansion-initializer; and for-range-declaration = u...[i]; then it would allow also zero "itereations". Though, structured binding packs can only appear in templates, so such a change isn't possible, it would need to be some special case.

Suggested resolution:

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