[Issue 1263] New: Template function overload fails when overloading on both template and non-template class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 10 16:21:22 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1263

           Summary: Template function overload fails when overloading on
                    both template and non-template class
           Product: D
           Version: 1.015
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dhaffey at gmail.com


struct A {}
class B() {}
class C {}

void foo()(int) {}
void foo()(A) {}
void foo()(B!()) {}
//void foo()(C) {}

void main()
{
    foo(5);        // ok
    foo(A());      // ok
    foo(new B!()); // error if C overload available
    //foo(new C);  // ok (with C overload available)
}

Uncommenting the C overload declaration produces this error:
template t.foo() foo() matches more than one function template declaration,
foo() and foo()

This is apparently only triggered by the call to the B overload.


-- 



More information about the Digitalmars-d-bugs mailing list