[llvm-dev] Expecting warning in int to short implicit conversion
Lokesh Janghel via llvm-dev
llvm-dev at lists.llvm.org
Thu Jan 30 03:52:47 PST 2020
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:
More information about the llvm-dev