<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/72536>72536</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang][ASTMatcher] `integerLiteral()` in function template only matches when the template was never instantiated
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
5chmidti
</td>
</tr>
</table>
<pre>
Given
```c++
template <typename T>
int foo() {
return 1;
}
template <typename T>
int bar() {
return 2;
}
void use() {
bar<float>();
}
```
and `integerLiteral().bind("literal")`, there is no match for `2` inside the function template itself, only its instantiations.
-> `integerLiteral(unless(isInTemplateInstantiation())).bind("literal")` is missing the match for `2`.
https://godbolt.org/z/azxn3fnhe
The traversal kind does not change the results.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMk91upDoMx5_G3ERFEL4vuGg75ajSOVdnXiAQAzknJKPETLd9-lVg2p3dzlYrWUAc-4f9jyO8V5NBbKF4gOIQiZVm69pimBclSUW9la_tX-qMhkFygOQeymS3AfhDsM1LuJy0IGSQPdLrCY1YkB0he9q3lSE2Wgu8Bt4wqC5ZjDHmkFZnWArZxQnV4Y-ZvXBfMPln5v48WyXZ6vFWbkBmj6O2gsKvtogbnHcV9qUwkkGZKEM4oftbETqh99y4V0Zun1y_-3lglgnwR0YzOmTKM2PZImiY2WhdYHEoE6aMVxJDEBtXM5Cyhn3IosijHgPEGv0aliGehCElQqSPr3u-g-zpZo2r0eg98Fr5Z3O8wJ-vQRcRNvuindDForxXZtoq_tTOT_XMRCcP2T3wDng3WdlbTbF1E_DuDXgn3r6ZbDQzXicdZ2TkxBmdF5r9r4xk0mIQj9gwCzPtWjn0qyYfR7LNZJM1IsI2rZIkLfKG19HcNkKURY_5gLVIMqx5k1aJyHsc876XWROplic8S9O0TKu04Hlc9bwuRCPztO6bKi8hT3ARSsdan5dQdqS8X7GteJGVkRY9ar_dKc4HLcwUVCoOkWtD_F2_Th7yRCtP_geBFOntIu4ZxQGKh_t_j_8EHdFBcfjdjO2jcmNEtsHYzgE9e5nRbPJ8bL8Izwye0V0NDspodbr95XgUzWsfD3YB3oV6L6-7k7P_4UDAu619D7zbFPgeAAD__8K9UWw">