| Issue |
76313
|
| Summary |
`bugprone-implicit-widening-of-multiplication-result` should suggest suffix instead of cast if using literals
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
felix642
|
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
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs