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

    <tr>
        <th>Summary</th>
        <td>
            [clangd] Incorrect navigation caused by deducing this
        </td>
    </tr>

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

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

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

<pre>
    ```c++
struct B
{
 template<typename Self>
    auto bar(this Self &&) 
    {
 return 0;
    }

    auto bar2(this B &&)
    {
        return 0;
    }
};

struct A
{
    auto foo()
    {
 return B{};
    }
};

auto baz(int n)
{
    return n;
}

int main()
{
    A a{};
 baz(a.foo().bar());

    A a2{};
    int n  = a2.foo().bar2();
}
```
incorrect navigation of a.foo and a to baz, a2.foo and a2 to n

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEk8-OmzAQxp9muIwW4TEEOHBIlkbquU9gsAFXYCLbbJU-fQVxNn821SJLgD3z-74ZGOGc7o1SFWQHyOpILH6YbXWezkPUzPJcwS65rBbosK6khmTvvF1aj-EN8vCAXk2nUXgF_N2fT8qISeEvNXbAf4QIRBSLn7ERFqjwg3ZbAALttlXiLfDGtcov1mAC_HB_XAf9L2i6sg838CtuuL7B5_XnwUP5--fyrw66eQYq_qMZxA7rzh35G8lQ2V-gQhuP5hP-oB7Y5pb82KM1dRLa3Lt7AOxRPPu6iIr4s6j48u1WAJVPNgODXhS32UYEXqOgRxoF3FfX17_var-drVWtRyM-dC-8ng3OHW7mUBiJAq9teg8ql21a982FEsmKy5KXIlIVyznbZQUVaTRUZZoUkrqykFnHd4IVCU94I3PZKsGJd5GuKKGUMZYlBWOUxnlXqCaXIm85y1lJkCZqEnqMx_FjimfbR9q5RVWM7TjPolE0anTbrBEZ9Qe3UyBaR89Wa9Jbs_QO0mTUzrsbxms_bkPajsL0ErIaf75qRisWpyQ2Z5RKLq02Pa5zEC12rAbvTw74HugIdOy1H5YmbucJ6LjqhNvbyc6_VeuBjps7B3QM9j8q-hcAAP__uoEhgQ">