This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
Currently, a structured binding pack can only be declared in the for-range-declaration of an expansion-statement if there is an enclosing template. Make entities declared therein templated entities.
Consider:
struct B
{
int i;
long l;
};
struct A
{
B b;
};
void f(int i, long l);
int main()
{
template for (auto [ ... e] : A()) {
f(e...); // OK
}
}
Proposed resolution (approved by CWG 2025-11-08):
Change in 13.1 [temp.pre] bullet 8.2 as follows:
An entity is templated if it is
- a template,
- an entity defined (6.2 [basic.def]) or created (6.8.7 [class.temporary]) within the for-range-declaration or compound-statement of an expansion-statement (8.7 [stmt.expand]),
- ...