[Issue 8700] New: Inner type deduction?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 20 10:13:42 PDT 2012


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

           Summary: Inner type deduction?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-09-20 10:14:39 PDT ---
Maybe according to D specs this is not supposed to work, but is this good to
support? It's useful as inner types are becoming more and more common in D
code:


struct Tree1 {
    static struct Node { int x; }
}
struct Tree2 {
    static struct Node { int x, y; }
}
void foo(T)(T.Node n1, T.Node n2) {} // ***
void main() {
    Tree1.Node n1, n2;
    foo(n1, n2);
}



DMD 2.061alpha gives:

temp.d(10): Error: undefined identifier T.Node
temp.d(10): Error: template temp.foo does not match any function template
declaration
temp.d(10): Error: template temp.foo(T) cannot deduce template function from
argument types !()(Node,Node)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list