(Maybe related to #40556.)
(Complete repro steps.)
auto foo(auto ...x) {
return [...x = x](auto ...f) {
(f(x), ...);
};
}
int main() {
foo(0)([](auto x){ return x; });
}
Compiling the code above via
clang++ -std=c++20 -Wall file.cpp
produces this spurious warning:
file.cpp:2:16: warning: lambda capture 'x' is not used [-Wunused-lambda-capture]
2 | return [...x = x](auto ...f) {
| ^
file.cpp:8:5: note: in instantiation of function template specialization 'foo<int>' requested here
8 | foo(0)([](auto x){ return x; });
| ^
1 warning generated.
$ clang++ --version
clang version 18.1.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin