www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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')


-- 
Jan 23 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=877


bugzilla digitalmars.com changed:

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





Works in DMD 1.004


-- 
Jan 27 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=877


thomas-dloop kuehne.cn changed:

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





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


-- 
Feb 27 2007