<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97809>97809</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy][request] Detect floating-point casts that cause loss of precision
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chrchr-github
</td>
</tr>
</table>
<pre>
~~~c++
double f(double a, double b, float c) {
return a + (float)b + c;
}
~~~
The result of the cast is used as `double`, so it is unlikely to be intentional.
There should be no warning when the cast affects overload resolution though.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxMUtGOmzAQ_JrlZZXILAHCAw-XRvmC_oAxC3brs1N7fad7ybdXhKhXCYmRNTOe9azO2a2BeYT2Au210kVsTKOxydh0WJ3YMlVTnL_Gx-NhgC7bp66g3uZYJs-4AJ1fUAP9wBeeNrz4qAUN0IDQv2SIiImlpIAagS4IdH7ygIbpeWCgeXGhv-7g8Xjs4KdlTJyLF4wLimU0Ogu6jCXzjDojdGqPAJ3aMuSIbicE736z_0KJODG6IBzExaD98Z93Ysw2Fj9vjBDxU6fgwoqflsP3bXpZ2EjG-MHJRz1viaIvmxmKjWW1x2oem3loBl3xWPek6v40UFfZcTh352VaGqLzcqrrSdW6Mc3S6rZbtDqZyo2k6KR61daKSHXHuplaWgxP_ay7ru7gpPhdO3_0_uP9GNNauZwLj0N_VkPl9cQ-P9skMl6H9SBu_gKird00bqLDVNYMJ-VdlvxtI078cw_-k7VXaC-J_xTOAu0VryxsZC_WhfVwjy7I81Uyit3K1iUz-pjzVtA9sXHZxVCV5Ecrcs_QvAHdgG77bh1NfAe6bSFev8M9xV9sBOj2HCwD3fbZPkb6GwAA__-6gtzJ">