<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116928>116928</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
CallExpr has incorrect begin location with "deducing this"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
c++23
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HighCommander4
</td>
</tr>
</table>
<pre>
In the following code:
```c++
struct S
{
int bar(this S&);
};
int main()
{
S waldo;
int x = waldo.bar();
}
```
The AST dump of `main()`, taken with a recent trunk, is:
```
`-FunctionDecl 0x55ac3a911f78 <line:6:1, line:10:1> line:6:5 main 'int ()'
`-CompoundStmt 0x55ac3a912988 <line:7:1, line:10:1>
|-DeclStmt 0x55ac3a9127c8 <line:8:5, col:12>
| `-VarDecl 0x55ac3a9120a8 <col:5, col:7> col:7 used waldo 'S' callinit
| `-CXXConstructExpr 0x55ac3a9127a0 <col:7> 'S' 'void () noexcept'
`-DeclStmt 0x55ac3a912970 <line:9:5, col:24>
`-VarDecl 0x55ac3a9127f8 <col:5, col:23> col:9 x 'int' cinit
`-CallExpr 0x55ac3a912948 <col:19, col:23> 'int'
|-ImplicitCastExpr 0x55ac3a912930 <col:19> 'int (*)(S &)' <FunctionToPointerDecay>
| `-DeclRefExpr 0x55ac3a9128b0 <col:19> 'int (S &)' lvalue CXXMethod 0x55ac3a911e58 'bar' 'int (S &)'
`-DeclRefExpr 0x55ac3a912860 <col:13> 'S' lvalue Var 0x55ac3a9120a8 'waldo' 'S'
```
The `CallExpr` for `waldo.bar()` is reporting `col:19` as its begin location, even though the descendant `DeclRefExpr` for `waldo` is at `col:13`.
This is misleading, and causes problems for tooling like clangd whose hit-testing algorithm (used for go-to-definition) skips the `CallExpr` node when hit-testing the `waldo` token because it falls outside of the `CallExpr`'s reported source range.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8Vl1v4ygU_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