Lokesh Janghel via llvm-dev
2020-Jan-30 11:52 UTC
[llvm-dev] Expecting warning in int to short implicit conversion
Hi devs, Please consider below two cases. case 1: void foo1 () { short val = 0, x = 1; val = (5 * x); // Here we expect implicit conversion( from int to short) warning // but clang does not warn with( -Wconversion). } case 2: 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: https://godbolt.org/z/P6nQZ4 Thanks Lokesh