It's also from LLVM, one bug that was seen by that: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87396 Example of error message: implicit conversion from 'int' to 'char' changes value from 132 to -124
We do warn about this, but only with -Wconversion which is not in -Wall or -Wextra c.cc:1:24: warning: conversion to ‘char’ from ‘int’ may alter its value [-Wconversion] char f(int i) { return i; } ^
(In reply to Jonathan Wakely from comment #1) > We do warn about this, but only with -Wconversion which is not in -Wall or > -Wextra > > c.cc:1:24: warning: conversion to ‘char’ from ‘int’ may alter its value > [-Wconversion] > char f(int i) { return i; } This is not the "constant" case. A testcase would be: char foo(void) { return 132; } <source>: In function 'char square()': <source>:3:12: warning: conversion from 'int' to 'char' changes value from '132' to ''\37777777604'' [-Wconversion] return 132; ^~~ I think the constant case should be safe for -Wall. It is a just a matter of adding more specific flags.
Is clang's -Wbitfield-constant-conversion anything like the -Wbitfield-conversion flag requested in bug 39170?
(In reply to Eric Gallager from comment #3) > Is clang's -Wbitfield-constant-conversion anything like the > -Wbitfield-conversion flag requested in bug 39170? It's similar, but if I see correctly the LLVM warning is only about constants: https://godbolt.org/z/srLT8m