https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90538
Bug ID: 90538 Summary: Redeclaration error when expanding parameter pack multiple times in a lambda Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wtt6 at cornell dot edu Target Milestone: --- With gcc-9.1.0, compiling this code --------------------------------------- template <class... T> void a(const T&...) {} template <class... T> void b(const T&... t) { [&]() { a(t...); a(t...); }; } void c() { b(1); } --------------------------------------- gives errors --------------------------------------- test.cpp: In instantiation of ‘void b(const T& ...) [with T = {int}]’: test.cpp:13:6: required from here test.cpp:8:7: error: redeclaration of ‘const int& t#0’ 8 | a(t...); | ^ test.cpp:7:7: note: ‘const int& t#0’ previously declared here 7 | a(t...); | ^ test.cpp:6:3: error: member ‘b(const T& ...) [with T = {int}]::<lambda()>::<t#0 capture>’ is uninitialized reference 6 | [&]() { | ^~~~~~~ 7 | a(t...); | ~~~~~~~~ 8 | a(t...); | ~~~~~~~~ 9 | }; | ~ test.cpp:6:3: error: designator order for field ‘b(const T& ...) [with T = {int}]::<lambda()>::<t#0 capture>’ does not match declaration order in ‘b(const T& ...) [with T = {int}]::<lambda()>’ --------------------------------------- This was accepted by gcc 8.3.