[cfe-dev] Warning for unused lambda captures

Aaron Ballman via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 16 12:29:24 PST 2016


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.

~Aaron

>
> --
> Malcolm Parsons



More information about the cfe-dev mailing list