void test(T)(T* arg);
void test(T)(ref T arg);

Let p be any pointer. Why is test(p) not an ambiguity error? Why is the second overload chosen? Making the first one take auto ref T* lets the compiler choose the first. Making the second one non-ref lets the compiler give me an ambiguity error.

Template Functions are not mentioned in the spec, at least not on https://dlang.org/spec/function.html#function-overloading, but it suggests that ref should not make the decision if it can be bound to.

Reply via email to