<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68492>68492</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
readability-avoid-const-params-in-decls has a misleading source location
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cjdb
</td>
</tr>
</table>
<pre>
`int square(int const num);` has the source location `1:12`, which is the start of the type. While the command-line diagnostic shows squiggly lines underneath the `const`, editors are tricked into putting squigglies under `int`, which leads some programmers to think that there's something wrong with the type.
`int square(const int num)` renders correctly, so I suspect that the current logic is making an assumption about the placement of `const`.
[Here's an example on Compiler Explorer.](https://godbolt.org/z/z56Pz75jM)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcU09zpTYM_zTmouGNMYEXHzgkm75pD53prWdhK-DEf6gtNvv203dMXtpNDpgRlvT7g4SluCUSTWJ4FMNTgzuvKU_mxc7NnOx1EqN0kaH8s2Mmoe5rYFIsDHEPQmnRP4pRwooFeCUoac-GwCeD7FIEMcpO9A-dEqMU6hu8rc6s4G7JjJkhPR8BXzc6wd-r83TEJoWA0bbeRQLrcImpsDNQ1vRWKh-3LP4K9brAHi3lSMjrUStGeXC8gZJ1nHIBzAScnXklCy5ygm1ndnH56OY-OsG76k-cPaEtUFIg2HJaMoZAuQAn4NXFV-AVuYJXl87vifVigbec6ulu3A6dQj4J-XA7vzj87m79dHN4lJCp0ipgUs5k2F8rr5LgDyh72cjwf_Bg9pwpMvi0OFOdDvhaaWAELGUP2_FfcE77e_7m0VCoFen5V-M-cxwef_9QhhHoB4bNE6QI31LYnKcMv_3YfMqUT2J4Eup-Zd6K6B-Eugh1WZKdk-dTyotQl5_1Gca_fp6Hlz-F0o2deqt7jQ1N3ajHUWutZLNO57Hrz_r5WSutcLBSqwE7i3oepCaSd42blFR9J-W5O_fdMJ5G6oZuOMt-mI0eh17cSQro_Mn776HCN66Unabx_k6rxuNMvhyzr5TxGJeWnb0Kpeou5KkWtfO-FHEnvStc_m_Djj1NmdDi7Lzja4vfk7PtYV-7YcZQWhdbS8aXYz0Qgit1io6J-7wnzZ799MUyx-s-n0wKQl0q7O3Vbjm9kGGhLoeUItTlUPNvAAAA___EzEPF">