<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/155484>155484</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `-Wdeprecated-this-capture` and `-Wunused-lambda-capture` contradict each other
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          r-barnes
      </td>
    </tr>
</table>

<pre>
    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-capture` the compiler determines that `this` 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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVE2P6zYM_DXyhUjgyPHXwYd93QbYQ8_vTEuMra4suaKc9P37QnKCDVpgCwQIbIszwyFHyGwmRzSI-oeo3wvc4uzDEA4jBkdcjF7_Gj6EbG8EI5GDzeFoCaKHcTNWAzr44-fvcPUB4mwYDPNGQv4G4xbBOPBbACE7i2HKr5VfVkt_C9mD8ppGZIIP8CNTuBHEGSOYKGTLsHpm8-Ca8UYgmvLwU9MaSGEkfUh8B4Vr3AKJpoQYzDRRSOeN0yYd2gHvBI5Ii_JNNOXjV76ljqv3pCkBifpdyC7JEu0PsLiMGkG07_8qSl15p7KYXNaUMCPv3qDWpHeZm9uY9GHHeRV5N9bC1eL0ipABjJtgLzsm0vLtw4F3BMZxxETprxBnAhz9jYBN3DAa715x7si5U9LJhAU_CRAUWpse0fk4U4CF4uz1E-26OZVgjvARc_2r7QuGz93CRxFyouOI0ags_BopwH02av6PDg_WuzSPQH9tJpBOVrOHlcKMKyf2QIDhpReGe3652_3trGfKq2QsBdAUKSzGEe9iX5SYpyHPlfx-Oobhud7aA4ImWikAOrS_OH10-osNTMz4Porq8hiZkK21oLyLxm0Zx3r_meOxJ-Wp444u7mPKy7Bnx4FKeWC_UJr8ffbARJyI0pIZTcjHQg-V7qseCxpObd3Iqm37rpiHpunrqmtrXUtN5Umr-qr0qa_ofFbXUjaFGWQp67KTzak_93V3xGuNY_5adV0te3EuaUFjj9belqMPU5HjPJzq-tydC4sjWc5XhZSO7s-wy3RzhCEVHcZtYnEureHIXzDRREvD_wU4ufv9fJKxAbVREQjVDHmjiy3YYY5xZVG9CXkR8jKZOG_jUflFyEtS8fg7rMH_SSoKecnaWcjLo7nbIP8JAAD__2B5rGE">