<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124450>124450</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
HeuristicResolver cannot resolve chained dependent field access
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
HighCommander4
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HighCommander4
</td>
</tr>
</table>
<pre>
In the following code:
```c++
int next;
template <typename T>
struct Link {
Link<T> *next;
};
template <typename T>
void foo(Link<T> *link) {
link->next->next;
}
```
HeuristicResolver is able to resolve the first `next` in `link->next->next`, but not the second.
This can be seen in clangd: go-to-definition on the second `next` will also offer the unrelated global variable as a result, indicating that it's falling back to the textual heuristic because semantic resolution failed.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMU01u8zgMPY28IRIosmM7Cy_StEEHmNWgF6Al2tZUlgKJTtvbD-Sk08zP4gMICKTI98gnEVOyoyfqxP5JKPVqx-kU5hm9oVgJpcT-ucCFpxC7f94VfTBf3W8eeCIYgnPhw_oRdDAkyqOQq9XyZlqop2zyaD2Dp08W5dMth2m-OGQCUZ7460IeZ4I3Ub4IeUwcF83wu_XvIJpcAKsjylPOAKGOD1jN8y-BXoM1MIQgVPsvLJdddfibKvsbUb5kju_zh-thvBvpKy3RJrb6D0rBXSmCTYC9I-AA8Ra7qWVjYhC1XAFrCdZn73_painUCfqFwQdeqxPp4M32xvk22QQaPfT5gnyG0g79aER5hDFsOGwMDdZbtsFD8A8Qjx18WOcAXQoQhoHimrX4SFlEA6MLPTq4YrTrPJgA80SL49yd9cZq5Pz8PCGDZaGaBAM6l2M96vcsQcZk-uQFHUzfWkFPGpeUe5rR58Cq1LK2O6B1ZLaF6UpzKA9YULdryqZtqlrWxdRVphn21PaHYdcoxKaXh3KQQ0tNU-3Kpi1sp6Tay52qZb2vq3rbVppkS01ZoZStOYhK0ozWbZ27ztsQx8KmtFC3U1W1l4XDnly678aqqyiPQwyeyZv7dsQu1276ZUyiks4mTj9obNlR99-fodHn9_z-FXpC68mAoQt5Q55hsOQMoNaUUrFE103Ml5Q3S52FOo-Wp6Xf6jALdc5s92NzieFP0izUeR0kCXW-z3Lt1F8BAAD__2Y5Q3s">