https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66543
Bug ID: 66543 Summary: False positive warning "variable set but not used" Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ldionne.2 at gmail dot com Target Milestone: --- The following code triggers a "unused but set variable" warning on GCC trunk: int main() { auto f = []() { }; [=](auto) { using Foo = decltype(f()); }; } I think it is a false positive, since `f` is obviously used. > g++ --version g++ (GCC) 6.0.0 20150613 (experimental) > g++ -std=c++14 worksheet.cpp -fsyntax-only -Wall -Wno-unused-local-typedefs In function ‘int main()’: warning: variable ‘f’ set but not used [-Wunused-but-set-variable] auto f = []() { }; ^ Regards, Louis Dionne