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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] "bugprone-return-const-ref-from-parameter" - should consider `*this` as a parameter
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          denzor200
      </td>
    </tr>
</table>

<pre>
    As I suppose this check is expected to show warning in `A::getThis` method:
```
struct A {
  const A& getThis() const{ return *this; };
};
```
But it didn't. Logically I don't see any difference between `A::getThis` method and `getThis` regular function like this:
```
const A& getThis(const A& a) { return a; };
```
But the alalizer thinks that there is a difference! And show warning only for `getThis` regular function.
The warning should also be provided for  `A::getThis` method because the known lifetime issue is also actual for it:
```
const auto& a = A().getThis();
// dangling `a`
```

The full snippet here: https://godbolt.org/z/xb669s6f3

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVNGOozgQ_JrmpUVkTALkgQeiUaSV7nF_oMEN-MaxkW0mm_n6k0lmN7N3NytZArmpcle5GgpBT5a5hcMJDi8ZrXF2vlVs352XQmS9U7e2C_gNw7osLjDGWQccZh5eUQfkHwsPkRVGh2F2V7ySt9pOqC1CJToo05o4fp91gErghePsVNoWHVTisUQXol-HiB1CfQLRIQ7OhogdyAo_4LIBebwXoD6h57h6iyC71BOUJ4T6BcoE__XydMRpjagjKq0syDru8C836YGMueE3VG7bxMCMZG-o9DiyZzsw9hyvzF_qQbIq1Z8KnqfVkMdxtUPUzqLRr3f3_i3-P7U-bVLS_SSZPov9TWOcGcmQ0e_s04H2NWCcaSt4TrdGT_JAFthZ9fn2nDU3HJ3_g6YdiO77zD9hYXarUUgmOOwZF-_etGK1MX1pX88DrVu4GF-tuya3Ro76ktoN673pxEpDXMlshDr-n5G0RrfZhlC-JAdTbnafUvRwTp5BnlGRnUzqHypBd6Jn0ofIcTUGg9XLwhGTk1B2OMe4bBe6MU1O9c7EnfMTyPM7yPOPvqqOoRpLEF2m2lIdyyNl3Bb1vj4c66ZpsrlVBXFPTSG47IU8Uk31no-ibppCDcRDplsp5EEciqY4HgpZ73jsuewbKlQ1sKr2sBd8IW12xrxd0vHZZltb7MW-LjNDPZuwDbmUgyE75VGrG0iZht63CZX36xRgL4wOMfziiTqa7ffwBDu8IEjZr9PineX8Hsp88z73POajd5d8IU8XjuxBSsw_opE-0oq3YH0MbiWQUiZ_IrLVm_Y3Z3Wc1343uAvIc2ru8cgX7_7mIYI8b4oDyPND9Fsr_wkAAP__GxmGeA">