I would like to be warned about implicit conversions from any floating point type to any integer type, but not about the narrowing conversion from double to float. E.g for this code
int main() {
float f = 0.2f;
int i = 1;
double d = 0.3;
i = f;
i = d;
f = i;
f = d;
d = i;
d = f;
}
I'd like to get a warning on i = f; and i = d;, but not on any other line.
In clang, this can be achieved via -Wfloat-conversion or -Wconversion -Wno-implicit-float-conversion (the latter one will enable all conversion warnings except that single one I don't want).
But in GCC, things are different. -Wfloat-conversion enables all lossy conversions from floating point types at once and I cannot find a flag to further differentiate what it is being converted to. -Wimplicit-float-conversion does not exist.