[PATCH] D28467: [Sema] Add warning for unused lambda captures

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 13 05:27:41 PST 2017


aaron.ballman added inline comments.


================
Comment at: test/SemaCXX/warn-unused-lambda-capture.cpp:86
+  auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // expected-warning{{lambda capture 'i' is not required to be captured for use in an unevaluated context}}
+  auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture 'i' is not used}}
+
----------------
malcolm.parsons wrote:
> I don't know why the unevaluated context warning didn't work here.
Hmm, it should have, come to think of it. I don't think that's an odr-use (when I get near a standard, I'll double-check), and it is unevaluated. Worth poking at.


https://reviews.llvm.org/D28467





More information about the cfe-commits mailing list