DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
Missing warning for implicit cast to signed int from literal > max int
Generally, implicit casts from literal values that don't fit into the range of a target type will produce a warning and tell you the different value that will actually be used (based on truncation, etc...).
Here's an example:
// warning: implicit conversion from 'literal int' to 'int' changes value from -3000000000 to 1294967296
int val = -3000000000;
However, if the value is larger than the maximum positive value for a signed int, but fits into the equivalent bit-sized unsigned value limit, no such warning is emitted:
// no warning, because it fits into unsigned limit for same bit-sized int
int val = 3000000000;
I think we should emit a warning for this case.