The compiler knows the sqrt prototype, so it can - and will - generate code to convert the int argument to double before calling the function.
The same thing happens and vice versa: if you pass a double function (with a known prototype) with an argument int , the compiler will generate the required conversion code.
Does the compiler warn about such transformations only the compiler and the level of warning that you requested on the command line.
To convert int -> double , which is usually (with 32-bit (or 16-bit) int and 64-bit doubles in IEEE754 format) lossless, getting a warning for this conversion is probably difficult, if possible at all.
To convert double -> int , with gcc and clang, you need to specifically ask for such warnings using -Wconversion , or they will compile the code without any problems.
source share