Let's see the following function overloading declaration
void funA(int);
void funA(float);
Then we call the function like this:
funA(1); // this will be ok.
however,
funA(1.333) // this will not ok..
To the compiler, funA(int) and funA(float) will be ambiguous.. The compiler will cast 1.333 value to integer (1) .. although assuming it's a float value would be more appropriate..
I'm using g++ (GCC) 4.8.2 Why the compiler will not call funA(float) instead? The following works however..
funA(static_cast<float>(1.333))