On Thursday, 24 November 2016 at 17:47:04 UTC, Steven Schveighoffer wrote:
void foo(T)(T t){writeln("a");}
void foo(T...)(T t){writeln("b");}

foo(1);

Compiles? If so, which prints out?

I was surprised by the answer. I can't find docs for it. Is the behavior intended?

-Steve

That is expected.
The general rule is go for the narrowest match.
Since a matches a smaller set then b.
a is selected.

Reply via email to