[Issue 877] New: forward references in interdependent template/struct definitions since v1.0

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 23 09:08:36 PST 2007


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

           Summary: forward references in interdependent template/struct
                    definitions since v1.0
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: manuelk89 at gmx.net


// a struct S having a pointer to a template instance that itself has
// the a value of type S as member:

struct T(FOO)
{
        S s;
}

struct S
{
        T!(int)* pt;
}

------

The struct S has a pointer 'pt' to a value of the template type, so the size of
'pt' is known and it should compile.

But compiling this with dmd v1.0 gives:

   A.d:3: struct A.T!(int).T has forward references
   A.d:9: template instance A.T!(int) error instantiating

It compiles well with dmd v0.177 and v0.178. (previous versions untested)
It also compiles well with dmd v1.0 if...

  - you comment out 'S s;' in the template
  - you write 'S* s;' instead of 'S s;'
  - make S a class type (ie. 'class S' instead of 'struct S')


-- 



More information about the Digitalmars-d-bugs mailing list