Thread overview
[Issue 877] New: forward references in interdependent template/struct definitions since v1.0
Jan 23, 2007
d-bugmail
Jan 28, 2007
d-bugmail
Feb 27, 2007
d-bugmail
January 23, 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@digitalmars.com
        ReportedBy: manuelk89@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')


-- 

January 28, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=877


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #1 from bugzilla@digitalmars.com  2007-01-27 19:09 -------
Works in DMD 1.004


-- 

February 27, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=877


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All




------- Comment #2 from thomas-dloop@kuehne.cn  2007-02-27 10:48 -------
Added to DStress as http://dstress.kuehne.cn/compile/f/forward_reference_18_A.d http://dstress.kuehne.cn/compile/f/forward_reference_18_B.d


--