<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76313>76313</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`bugprone-implicit-widening-of-multiplication-result` should suggest suffix instead of cast if using literals
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
felix642
</td>
</tr>
</table>
<pre>
Currently the check `bugprone-implicit-widening-of-multiplication-result` will suggest to add `static_cast` to multiplication if the result is stored into a wider type.
The check should instead suggest to add the proper suffix if the operation contains `literals` rather than variables.
So the following code:
```
uint64_t fn()
{
return 1024 * 1024;
}
```
Shoud look like this after applying the suggested fix:
```
uint64_t fn()
{
return 1024LU * 1024;
}
```
This should be configurable to keep the option to add `static_cast` if this is the preferred method in a codebase.
godbolt: https://godbolt.org/z/Pc1K1563s
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysk8-O2zgMxp9GvhAJbDlxkoMPMzvIZfewQKfngSzRNhtFMiRqMunTF3Kc_hm0hxYFgliW6I8_8SNVjDQ4xFZsH8X2qVCJRx_aHi29NRtZdN5c239SCOjYXoFHBD2iPoFoyi4NU_AOV3SeLGni1YUMOnLDyverc7JMeV8xebcKGJNl0ZRwIWshpmHAyMAelDFZLbJi0i9axTmKPfyoANTP6W9CQBEi-4AGyGURyLkD8HXCNYjySZQPt__nr8hx9Mnm-MiozHuErD0FP2GAmPqe3u4J89aNQHvHilzMuJYYg7IxswbFY849KgevKpDqLMb1Lf0HP4v03lp_ITeA9gZFvcCJplx-82six83mhaF3Qu6FPCxRu8fbAgAgIKfgoCrlBoR8mBeifrxHPv1UeGEZfTJgvT-BpRMCjxRB9YwB1DTZa8bLsEtl0EBPb3-J9b-Pv0v7nOkWzzrMxe9pSCEXN3t2QpwWf2ZzftlJs40Uc8fcPMYeQ26cM_Locz-Aml3pVMT19wSDN523LOoHGJmnmEshj0Iel4O1D4OQx89CHv_X1b_VtqljYdraHOqDKrCtdmVdH8rdfluMLe66Su0Pjcat7rBEZfa11rra7qqd0YgFtbKUdSXlptyUjdyuq73c93uJBrXRterEpsSzIru29vWccxcUY8J219RVXVjVoY3zHEvp8ALzoZAyj3Vo8zerLg1RbEpLkeM3FSa22P75QC8e3efpPj3LmPkeshPZhhRzh90np0jBtu_qSjymbq39Wchj5lseqyn4T6hZyON8qyjkcb71lwAAAP__LVqFpQ">