[cfe-dev] Warning for unused lambda captures

Malcolm Parsons via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 9 04:44:31 PST 2016


I would like to add a warning for lambdas that explicitly capture
variables that they don't use.

e.g.
int i = 3;
auto f = [&i] { return 5; };

This is similar to Wunused-private-field. I propose the flag
-Wunused-lambda-capture.

Comments?
-- 
Malcolm Parsons



More information about the cfe-dev mailing list