Whichever overloaded function is to be invoked, the invocation argument list must be matched to the declaration parameter list according to the function selection algorithm:
- Use an exact match if found.
- Try standard type promotions.
- Try standard type conversions.
- Try user-defined conversions.
- Use a match to ellipsis if found.
Standard promotions are better than other standard conversions. These are conversions from float to double, and from bool, char, short, or
enum to int. Standard conversions also include pointer conversions.
An exact match is clearly best.
Casts can be used to force such a match. The compiler will complain about ambiguous situations. Thus, it is poor practice to rely on subtle type distinctions and implicit conversions that obscure the overloaded function that is called.
When in doubt, use explicit conversions to provide an exact match.
Signature matching has many subtleties and pitfalls. The current ANSI C++ standard document has over 50 pages of discussion and examples of the complexities of this topic.