Created on 2026-08-16.00:00:00 last changed 2 weeks ago
Proposed resolution (approved by CWG 2026-11-19):
Change in 13.7.4 [temp.variadic] paragraph 8 as follows:
A pack whose name appears within the pattern of a pack expansion is
expanded by that pack expansion if the target scope of the
declaration of the pack contains the point of the pack
expansion. An appearance of the name of a pack is only expanded
by the innermost enclosing pack expansion. The pattern of a pack
expansion shall name one or more packs that are not expanded by a
nested pack expansion; such packs are called unexpanded packs in the
pattern. All of the packs expanded by a pack expansion shall have the
same number of arguments specified. An appearance of a name of a pack
that is not expanded is ill-formed.
[Example: ...
int h(auto) {
([](auto ...xs){ xs; }, ...); // error: unexpanded pack
}
-- end example]
Proposed resolution (approved by CWG 2026-09-01) [SUPERSEDED]:
Change in 13.7.4 [temp.variadic] paragraph 8 as follows:
A pack whose name appears within the pattern of a pack expansion is
expanded by that pack expansion if unqualified name lookup
(6.5.3 [basic.lookup.unqual]) from the point of the pack expansion
finds a declaration of that pack. An appearance of the name of
a pack is only expanded by the innermost enclosing pack expansion. The
pattern of a pack expansion shall name one or more packs that are not
expanded by a nested pack expansion; such packs are called unexpanded
packs in the pattern. All of the packs expanded by a pack expansion
shall have the same number of arguments specified. An appearance of a
name of a pack that is not expanded is ill-formed.
[Example: ...
int h(auto) {
([](auto ...xs){ xs; }, ...); // error: unexpanded pack
}
-- end example]
(From submission #976.)
Consider:
struct S {};
int f(auto ... x) {
int a[] = { [&] {
auto[...y] = x;
return y; // #1
}()...}; // #2
return 0;
}
int x = f(S());
The use of y at #1 should be ill-formed due to the appearance of an unexpanded pack. The expansion at #2 should not apply to y. Some implementations fail spectacularly.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-11-19 20:46:27 | admin | set | status: tentatively ready -> ready |
| 2026-11-19 16:44:01 | admin | set | messages: + msg8720 |
| 2026-09-03 23:06:47 | admin | set | status: open -> tentatively ready |
| 2026-08-16 10:40:15 | admin | set | messages: + msg8648 |
| 2026-08-16 00:00:00 | admin | create | |