https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124977
Bug ID: 124977
Summary: -Wunused-but-set-variable diagnostic on parameter pack
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marcel at laverdet dot com
Target Milestone: ---
// a.cc
struct nothing {};
auto xx(auto xx, auto foo) {
auto [... args ] = foo;
(..., xx(args));
}
auto main() -> int {
xx(0, nothing{});
return 0;
}
-----
root[15:18:12] [/workspace] $ /root/gcc-16/bin/g++ -std=c++26 -Wall -Werror
a.cc
a.cc: In instantiation of ‘auto xx(auto:1, auto:2) [with auto:1 = int; auto:2 =
nothing]’:
a.cc:9:4: required from here
9 | xx(0, nothing{});
| ~~^~~~~~~~~~~~~~
a.cc:4:14: error: structured binding declaration set but not used
[-Werror=unused-but-set-variable=]
4 | auto [... args ] = foo;
| ^~~~~~~~~~~
cc1plus: all warnings being treated as errors