arocc
arocc copied to clipboard
Warn if implicit integer conversion truncates value
unsigned char x = 1000;
We currently issue no warning; it should look something like:
test.c:1:19: warning: implicit conversion from 'int' to 'unsigned char' changes value from 1000 to 232 [-Wconstant-conversion]
unsigned char x = 1000;
^
Value.intCast currently returns void on success; we can have it return a value that indicates whether truncation happens and then issue a diagnostic if so (similar to how Value.floatToInt is handled)