On Friday, 22 January 2016 at 01:33:42 UTC, Darrell Gallion wrote:
void foo(A)()
if (!is (A == int)) {
pragma(msg, "int");
}
void foo(A)()
if (is (A == int[])) {
pragma(msg, "int[]");
}
void main() {
foo!(int)();
foo!(int[])();
}
===========
source\app.d(15): Error: template app.foo cannot deduce
function from argument types !(int)(), candidates are:
source\app.d(3): app.foo(A)() if (!is(A == int))
source\app.d(8): app.foo(A)() if (is(A == int[]))
source\app.d(16): Error: app.foo called with argument types ()
matches both:
source\app.d(3): app.foo!(int[]).foo()
and:
source\app.d(8): app.foo!(int[]).foo()
Have a look at the first template constraint. It checks whether
the template parameter _is not_ `int`, so of course, the first
instantiation fails, and the second one is ambiguous.