[Issue 17983] Integer literal should prefer int to char overload

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 16 07:32:50 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17983

--- Comment #5 from Mike <slavo5150 at yahoo.com> ---
Taken from http://forum.dlang.org/post/ouhm8h$90q$1@digitalmars.com

<quote>
Some really weird stuff is going on with aliasing and function overloads in
general.

If we change them from anonymous lambdas to actual functions:

auto lambda1(char c) { return 1; }
auto lambda2(int i) { return 4; }

alias foo = lambda1;
alias foo = lambda2;

void main()
{
   assert(foo('a') == 1);
   assert(foo(1) == 4);
}

Hey look, it all works!

Even if lambda1 and lambda2 are turned into templates, it works.
</quote>

--


More information about the Digitalmars-d-bugs mailing list