Created on 2025-11-11.00:00:00 last changed 3 weeks ago
Suggested resolution:
Change in 8.7 [stmt.expand] paragraph 3 as follows:
For an expression E, let the expressions begin-expr and end-expr be determined as specified in 8.6.5 [stmt.ranged]. 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() and E.end(), or
- argument-dependent lookups for begin(E) and for end(E) each find at least one viable function or function template.
(From submission #803.)
Subclause 8.7 [stmt.expand] paragraph 3 specifies:
For an expression E, let the expressions begin-expr and end-expr be determined as specified in 8.6.5 [stmt.ranged]. 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() and E.end(), or
- argument-dependent lookups for begin(E) and for end(E) each find at least one function or function template.
For the non-member case, this means any begin and end function will make an expression expansion-iterable. For example, a std::tuple is specified to be expansion-iterable, but it ought actually to be treated by destructuring.
Other appearances of "find at least one declaration" in the standard apply to member lookup only, e.g. in 7.6.2.4 [expr.await] bullet 3.2 or 9.7 [dcl.struct.bind] paragraph 7; the intent there is to "lock into" the member interpretation, giving a diagnostic if the begin or end member is not quite matching, e.g. due to missing const.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-11-17 22:26:35 | admin | set | messages: + msg8389 |
| 2025-11-11 00:00:00 | admin | create | |