<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/123549>123549</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
HeuristicResolver::getPointeeType discards qualifiers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clangd,
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
HighCommander4
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HighCommander4
</td>
</tr>
</table>
<pre>
`HeuristicResolver::getPointeeType()` returns a `Type *` rather than a `QualType`, which means it necessarily discards any qualifiers on the returned pointee type.
This can be important, as seen e.g. in clangd in the following code:
```c++
template <typename T>
struct Waldo {
void find();
void find() const;
};
template <typename T>
struct smart_ptr {
T* operator->();
};
template <typename T>
void foo(smart_ptr<const Waldo<T>> s) {
s->find();
}
```
Go-to-definition on the `find` token in `s->find()` offers both overloads of `Waldo::find()` as results, when it should only offer the `const` overload.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMk8GO4zYMhp-GvhAJFDm2k4MP2eyme2yLAXosZIm21cqSK9FZ5O0LxZ6d3cEeBjAQxyT_j79EqpTs4IlaqD6BlF_tMF7DNClvKB5BSqg-F2rhMcT251jRBfNooRZfaYk2sdV_UgruThHKC5SXgfj3YD0TvTxmAnkCeYZaYCReok-oEGqRQwjy8gwoHikij8qvwT8W5Z61tQB5xW-j1SNOpHxCy-hJU0oqWvdAY5NW0SRU_oH_LcrZ3lJMGDzySBuSDM5rQ8iPmfYgLiAuL6NNqJXHjtBOc4isPGecSpiIPNJ-2KP1qJ3yg8lvWbIPzoVv1g-og6Hs-KmWW30-GuSn_IgL0zQ7xYRQXjPXq4nwBcovIC6J46IZ_1LOBIQmpyPegzXYW2-2Myt_-Rl18InXIDSft5cP4dKkIv89c_yOfAF5wTBTVBziLif_gP6o-tpgCCBP3wlQXp99rhahvD5zyy-YsoVXfMrI944z9ocDXfm_hR2HnaHeess2-Ncbhlo862uBHP4ln68JavFeuBYY-j5PRhd4xHCn6IIyCUOf07cm8_T-XKQSRkqL47QOYgYwpjEszmDw7rHKvrayXk2GbYB9YdrSnMuzKqg9NGVTVrI5NsXYlqfG1M2BKlP3WtWKDkaej4dOdceDPp1PhW2lkJU4SCGq6iyave6EKJVoqqM-98aUcBQ0Kev2zt2nfYhDYVNaqD3IsjqeC6c6cmnb7nWG81bL6-vfbDYGz-TNtu6xzVK7bhkSHIWzidObOFt21H5o59_W8m0liyW6dmSeU66QN5C3wfK4dHsdJpC3zNl-dnMM_5BmkLenowTytpm6t_L_AAAA___zSHuF">