P4026R0 — Global lookup for begin and end for expansion statements (2 items) EWG
Vlad Serebrennikov
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.

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..."
[2]
"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.