P4026R0 — Global lookup for begin and end for expansion statements
(2 items)
EWG
This paper addresses a defect in the wording for expansion statements ([stmt.expand]) where the condition for an expression to be 'expansion-iterable' requires ADL for begin and end to each find at least one function or function template, causing types with partial ADL matches to incorrectly fail to fall through to destructuring expansion. The proposed resolution changes the criterion from finding at least one function or function template to finding at least one viable candidate, aligning behavior with range-based for and ensuring well-formed destructuring expansions are not incorrectly rejected.
- Page 6, "Potential consequences 1: members_of" code sample — N::TupleLike{} references a namespace N that does not exist in the example; all declarations are at global scope. Should be TupleLike{}, consistent with the equivalent example on page 7. [1] [1]
- Page 8, "Potential consequences 3: non-SFINAEble errors" prose — "iteration expansions statement" does not match the paper's own defined term from [stmt.expand] p4; should be "iterating expansion statement". [2]
References — Anthropic Citations API
[1]
"Potential consequences 1: members_of 6 struct S1 { int array[8]; }; template int* begin(T&);
int* end(S1&);
struct TupleLike {
int first;
int second;
};
constexpr auto ctx..."
"Potential consequences 1: members_of 6 struct S1 { int array[8]; }; template
[2]
"errors outside of immediate context while checking for iteration expansions statement."
"errors outside of immediate context while checking for iteration expansions statement."
Summary: P4026R0 analyzes whether expansion statements (template for) should use the same global lookup rules for begin/end as range-based for statements, examining the consequences across members_of, structured bindings, and SFINAE contexts. Two items found: one incorrect namespace qualifier in a code example and one terminology inconsistency with the paper's own defined terms.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.