http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52281
Bug #: 52281 Summary: No warnings generated for unused captures Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: bootsare...@gmail.com I would expect the code: int main() { int i = 23; auto x = [&i]() {return 25;}; x(); return 0; } to issue a warning when compiled with -Wall -Wextra similar to unused variables. This seems similar to this: struct foo { int operator()() { return 42;} int x; }; gcc does not issue a warning here as well, although it might be useful.