www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3834] New: forward reference in templated class

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3834

           Summary: forward reference in templated class
           Product: D
           Version: 2.040
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



class Foo(T) {
    Node!T head;
    class Node(T) {}
}
void main() {
    auto f = new Foo!int;
}


dmd prints:

test.d(2): Error: template instance Node!(int) forward references template
declaration Node(T)

test.d(2): Error: Node!(int) is used as a type
test.d(2): Error: variable test.Foo!(int).Foo.head voids have no value
test.d(6): Error: template instance test.Foo!(int) error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3834




A simpler case example:

struct Foo(T) {
    Node!T head;
    struct Node(T) {}
}
void main() {
    Foo!int f;
}


dmd 2.043 prints many errors:

test.d(2): Error: template instance Node!(int) forward references template
declaration Node(T)

test.d(2): Error: Node!(int) is used as a type
test.d(2): Error: variable test.Foo!(int).Foo.head voids have no value
test.d(6): Error: template instance test.Foo!(int) error instantiating

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