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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 19 06:08:00 PST 2017


On Thu, Jan 19, 2017 at 8:45 AM, Malcolm Parsons
<malcolm.parsons at gmail.com> wrote:
> 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.

Drat, though I don't think this diagnostic warrants making changes to that.

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

Yes, I think that wording makes sense.

~Aaron

>
> --
> Malcolm Parsons


More information about the cfe-commits mailing list