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

    <tr>
        <th>Summary</th>
        <td>
            `misc-const-correctness.WarnPointersAsValues` not reported
        </td>
    </tr>

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

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

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

<pre>
    ```cpp
class A
{
public:
    void f(A*);
};

class C {
private:
    void f();
    A *a();
};

void C::f()
{
    A * /*const*/ a1 = a(); // no warning
    A * const a2 = a();
    a1->f(a2);
}
```
https://godbolt.org/z/cWKG6xWEv

If you remove the function call the warning is reported.

CC @JonasToth
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUkGzmyAQ_jV4YeIgRp8ePJjkpdP20kOnOSOskQ4BB9D09dcX8eUlTeuA7LK737cf0Bnx1qCSrIOPIyIHRFqumHO4XR30sluNceqU5Ch_38fhm40UuEe0ahENo0b57lZ0uNsPmHt8h7NyZh7-j_eItQRaHAjYU-Bfkli_XyDz9gbzt4gPsDCPYeFGOx-bP2KWYZQf8J1mzTlibfCVWS31-RkklmNGnwrvaSzboPx16YXR595X43b6qzt4P7pFQGQ-G9EZ5VNjz8H7HSY_ff1U_jq9zo-yP_f4zUzYwsXMgP0AuJ8099JozJlSceddAJYu5I3GehDpI8Y-XM2WfDGaue_GDwk0WVluS1pTUieiyUWd1yzx0itYXsxFOr6J6sPfWuBeg3PpKbB8M1J7sK51P5iawIXscIL-gzaZrGqedEo_TF3KzSU4Ss23ZTNa8zNgB1c6t2DRY1GRukqGhuZFVUBZVXwrClJlZZEJWomsfxFZJqBPFOtAuQYVO0SphiuOEMFGxSGRDSWUZoRkWU4IKdOyh4AMpWA5E0VFw2HAhUmVLn0sF5DYJrbUTWcXgko67-7B8LjlWQNEuoDPJj8Y2_TSwpXNkETuJvb-BxuP-JQ">