Created on 2025-10-01.00:00:00 last changed 3 weeks ago
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]),
- ...
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
}
}
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-11-17 18:45:11 | admin | set | messages: + msg8380 |
| 2025-11-17 18:45:11 | admin | set | status: open -> tentatively ready |
| 2025-10-01 00:00:00 | admin | create | |