Skip to content

CWG3045 [basic.scope.block] Expansion statements - redeclaration of for-range-declaration in the body #729

Description

@jakubjelinek

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

Reference (section label): [basic.scope.block]

Link to reflector thread (if any):

Issue description:
P1306R5 added expansion statement next to iteration statement in https://eel.is/c++draft/basic.scope.block#1.1 but has not done the same in https://eel.is/c++draft/basic.scope.block#2.2
I think it would be really surprising if

template for (auto g : whatever) {
  int g = 42;
}

was valid while

for (auto g : whatever) {
  int g = 42;
}

is not.

Suggested resolution:
Change
"substatement of a selection or iteration statement that is not itself a selection or iteration statement, or"
to
"substatement of a selection, iteration or expansion statement that is not itself a selection, iteration or expansion statement, or"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions