On 11/17/2012 07:28 PM, ref2401 wrote:
I get "template instance main.MyClass!(int) error instantiating" in the
following case:

public class MyClass(TStuff)
{
     public void foo(TStuff item)
     {}

     public void foo(TRange)(TRange items)
     if (isInputRange!TRange && is(ElementType!TRange == TStuff))
     {}
}

void main(string[] argv)
{
     MyClass!int instance = new MyClass!int();

     return;
}

but if i rename one of the "foo" overloads then code will be compiled.


Making the first overload a template fixes your issue, but note that your code is indeed valid D code. It is the compiler which does not implement overloading of functions vs. function templates yet.

Reply via email to