[cfe-dev] Warning for unused lambda captures

Jonathan Coe via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 16 14:00:31 PST 2016



> On 16 Dec 2016, at 20:29, Aaron Ballman via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> On Fri, Dec 16, 2016 at 3:27 PM, Malcolm Parsons
> <malcolm.parsons at gmail.com> wrote:
>> On 16 December 2016 at 16:14, Aaron Ballman <aaron at aaronballman.com> wrote:
>>> I think this could be a useful warning for explicit captures. It seems
>>> possible that someone may want to capture something by value purely
>>> for its RAII properties, but that seems unlikely to be common and
>>> could still be silenced with an explicit cast to void?
>> 
>> It looks like -Wunused-private-field checks
>> InitializationHasSideEffects(FieldDecl&) to avoid warning about such
>> fields.
> 
> Perfect! I figured we already had a solution for it, I just wanted to
> point it out as a possible false-positive to avoid. I think it's a
> great idea for a diagnostic in Clang.
> 

Sounds like a great idea. I'd be keen to use this check and happy to review a patch.

> ~Aaron
> 
>> 
>> --
>> Malcolm Parsons
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list