Skip to content

[stmt.expand] begin-expr and end-expr should refer to range #909

@xmcgcg

Description

@xmcgcg

Full name of submitter: Geng Cheng

Reference: [stmt.expand]

Issue description:
In paragraph 3, the exposition-only expressions begin-expr and end-expr are determined as specified in [stmt.ranged]. However, those definitions refer to the exposition-only variable range instead of the original for-range-initializer. The forms E.begin() and end(E) never exist in those definitions, range.begin() and end(range) are used instead.

Furthermore, the resolution of CWG3131 changes the definition of range for iterating expansion statements, begin-expr and end-expr should refer to this definition instead of the definition in [stmt.ranged].

Suggested resolution:
Explicitly refers to range in paragraph 3:
For an expression E, let the expressions begin-expr and end-expr be determined as specified in [stmt.ranged], where the exposition-only variable range is defined by the hypothetical declaration decltype(auto) range = (E); instead. An expression is expansion-iterable if it does not have array type and either

  • begin-expr and end-expr are of the form E.begin()range.begin() and E.end()range.end(), or
  • argument-dependent lookups for begin(E)begin(range) and for end(E)end(range) each find at least one viable candidate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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