Skip to content

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

Open

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

Activity

  1. jensmaurer commented on Oct 3, 2026

    @jensmaurer
    Member
  2. changed the title [-][stmt.expand] begin-expr and end-expr should refer to range[/-] [+]CWG3235 [stmt.expand] begin-expr and end-expr should refer to range[/+] on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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