September 01, 2018
Hi,
Is it by design that when calling functions with either ubyte or byte variables the char overload is called instead of the int (or generic) one?
September 01, 2018
On Saturday, 1 September 2018 at 17:17:37 UTC, puffi wrote:
> Hi,
> Is it by design that when calling functions with either ubyte or byte variables the char overload is called instead of the int (or generic) one?

It seems this is by design.

"If two or more functions have the same match level, then partial ordering is used to try to find the best match. Partial ordering finds the most specialized function."

char is more specialized than int, and since the implicit conversion byte->char exists, it is called. Even f(1UL) will call f(char) rather than f(long).