[Issue 8990] New: Forward reference error on three structs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 9 22:05:38 PST 2012


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

           Summary: Forward reference error on three structs
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: cbkbbejeap at mailinator.com
            Blocks: 340


--- Comment #0 from Nick Sabalausky <cbkbbejeap at mailinator.com> 2012-11-09 22:05:34 PST ---
>From digitalmars.D.learn:
http://forum.dlang.org/thread/mzssmbjertutrdgmrlyw@forum.dlang.org

struct A(T)
{
    T t;
}
struct B(T)
{
    A!(T)* a;
}
struct C
{
    B!(C)* b;
}

Result:
test.d(2): Error: struct test.A!(C).A has forward references
test.d(11): Error: template instance test.B!(C) error instantiating

Workaround:
Inside the definition of "struct B(T)", move "A!(T)" to an optional template
parameter:

struct B(T, U=A!(T))
{
    U* a;
}

This *might* be related to #6969, but I'm not sure.

-- 
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