[Bug c++/114450] -Wunused-but-set-variable false positive in lambda using another static auto lambda

2024-03-24 Thread olof.gullnas at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114450

--- Comment #1 from Olof Gullnäs  ---
This is observed on a Suse Linux X86 system

[Bug c++/114450] -Wunused-but-set-variable false positive in lambda using another static auto lambda

2024-03-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114450

--- Comment #2 from Andrew Pinski  ---
Reduced testcase:
```

template 
void foreach(F f) {f(1);}

void g ()
{
static constexpr auto lambda_2 = [](int) { };
auto lambda_1 = [](auto id) { lambda_2(id); };
foreach(lambda_1);
}
```