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

Malcolm Parsons via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 19 05:45:35 PST 2017


On 19 January 2017 at 13:16, Aaron Ballman <aaron.ballman at gmail.com> wrote:
> I wasn't thinking about that kind of odr-unuse when reviewing your
> patch, so I am starting to think that perhaps it's not worth
> distinguishing unevaluated contexts or not in the diagnostic. :-( If
> we could do it, then great (we seem to be able to do it for regular
> variable use: http://coliru.stacked-crooked.com/a/4bde9b5daf48956a),
> but if not, then I think we should just go back to the original
> wording that says it's not required to be captured (in all cases, not
> distinguishing odr-use) and put in a FIXME with the test cases that
> could have an improved diagnostic (including the test case talked
> about here, which we should add). What do you think?

The warning can distinguish:
* not looked up
* looked up
* looked up and used

It doesn't know why a variable was looked up but not used.

You suggested the wording "not required to be captured for this use"
earlier in this thread; is that better?

-- 
Malcolm Parsons


More information about the cfe-commits mailing list