<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95596>95596</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] performance-inefficient-vector-operation doesn't warn if loop has unsigned index
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MitalAshok
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/EWo1cTYGK
```c++
#include <vector>
void f(std::vector<int>& r) {
std::vector<int> v;
for (std::size_t i = 0; i < r.size(); ++i) {
v.push_back(r[i]);
}
}
void g(std::vector<int>& r) {
std::vector<int> v;
for (int i = 0; i < r.size(); ++i) {
v.push_back(r[i]);
}
}
```
The only difference is the loop variable `i`'s type being `std::size_t` or `int`, but the check only warns to reserve for `int i` in `g`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8lM2O4zYMx5-GvhAJFPoj8cGHfEx6KHoboOhpINu0rY4iBZLsNvP0heykkx1ggd3LAoIt0_yT-omipPeqN8wV5AfIT4kcw2Bd9YcKUu_9YN-T2ra3agjh6iHdA52Bzr1ta6vD2roe6PwBdH75026a179--x3ECcT-_izEMhqgQxyLlVJlGj22jJAeJ26CdZC-PAsnq1rsgHY-tDFpun-4HZUJ0ZkKdEAlwvYeFRHxe944Qfpw66zD58BeffBbQIWQnlBAepinR3Tr-AdoB1RG60Kgvs05ra-jH95q2bwD7RzkBwX5aVF8Lgu2pzvc_5NPyv7nKH8EEfFBqcwvJ3uU_Bn0dWC0Rt-wVV3Hjk3DqDyGgVFbe8VJOiVrzQiFUFFLW4_hdmWsWZk-mr_UCwqBEbEQET8qjliPYQ7ZDNy8L_n-kc54DBYde3YTL_syizAmQmXiZw-FSNoqbcu0lAlXm-1ml5ZFKfJkqIjKbLfblhnLRhBRl7a1LMtNRtss24g6URUJykSxyUjQjrK1SLsi7UqmglPKuhwywRep9Frr6RJ7JlHej1yVeV4WiZY1az-3H1GjpelXQbU3IIrt6KooWtVj7yETWvngP8MEFfTcuE-y_IRXdp11F2kaXinDXacaxSasliOzsld2MihrsLXsDdA2zBuFqlvKMUiPo5mvhRaVafnfZHT66xWgwjDW68ZegM5xRffX6urs39wEoPNM6YHOC-hU0X8BAAD__0p5R1M">