[Issue 1970] New: Templated interfaces not matched

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 3 00:22:36 PDT 2008


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

           Summary: Templated interfaces not matched
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: caron800 at googlemail.com


The following code won't compile:

    interface J(T) {}

    class A : J!(int) {}

    void foo(T)(J!(T) j) {}

    void main()
    {
       A a = new A;
       foo(a);
    }

The error is:
foo(T) does not match any function template declaration.

And yet it does. Change main to

    void main()
    {
       A a = new A;
       foo(cast(J!(int))a);
    }

and it compiles just fine. I contend that the explicit cast should not be
necessary.


-- 



More information about the Digitalmars-d-bugs mailing list