Skip to content

-Wdeprecated-this-capture and -Wunused-lambda-capture contradict each other #155484

@r-barnes

Description

@r-barnes

I've been unable to build an MWE for this issue, but in our (large, complex) codebase I observe that it's possible to have -Wdeprecated-this-capture trigger to indicate that we need

[=, this]() { lambda }

but once this has been added -Wunused-lambda-capture will flag this as being unused.

In one instance of the above situation this was needed to make a call to another method of the function. It was possible to mark that method as static after which this was no longer required, so perhaps there are situations where ``Wdeprecated-this-capturethe compiler determines thatthis` is needed, but `-Wunused-lambda-capture` is able to do a deeper analysis and determine it is not?

I'll continue to look for an MWE, but wanted to flag this in case someone who sees it has ideas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions