Fwd: Expecting warning in int to short implicit conversion
Please consider below two cases.
void foo1 ()
short val = 0, x = 1;
val = (5 * x); // Here we expect implicit conversion( from int to
// but clang does not warn with( -Wconversion).
void foo2 ()
short val = 0;
int i = 1;
val = (4 * i) ; // but in this case clang does warn with( -Wconversion).
GCC gives warning with( -Wconversion) for both test cases.
Like to know the community's thoughts on why clang does not warn for
the first case.
Here is Godbolt link for the above case: