D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1970 - Templated interfaces not matched
Summary: Templated interfaces not matched
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 major
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2008-04-03 02:22 UTC by Janice Caron
Modified: 2015-06-09 01:14 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Janice Caron 2008-04-03 02:22:33 UTC
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.
Comment 1 Janice Caron 2008-04-24 04:31:13 UTC
Increased severity to major, as this issue is blocking progress on Phobos development.
Comment 2 Neia Neutuladh 2009-02-22 20:25:20 UTC
This is related to #1715, I think -- at the very least, this would be a workaround for #1715 and #1714 if it worked.
Comment 3 Don 2010-09-03 11:27:33 UTC
The patch in bug 4173 also fixes this.
Comment 4 Walter Bright 2010-09-11 17:53:00 UTC
http://www.dsource.org/projects/dmd/changeset/675