| Issue |
171447
|
| Summary |
-Wimplicit-int-conversion feature request
|
| Labels |
clang:diagnostics
|
| Assignees |
|
| Reporter |
steakhal
|
PR #126846 started diagnosing unary negations. IMO that makes sense as in the following example it's going to narrow immediately, so the warning seems justified.
However, should we also warn for practically any other unary and binary operators that apply the standard integer promotion to int (if it was shorter than an int before)?
Like in `i = i | 1;`?
https://godbolt.org/z/3sEEWj8b7
```c++
unsigned short unary_negate(unsigned short i) {
i = ~I; // we get the warning here
return i;
}
unsigned short binary_or(unsigned short i) {
i = i | 1; // why not also warn here?
return i;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs