[Issue 945] New: template forward reference with named nested struct only

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 10 08:11:04 PST 2007


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

           Summary: template forward reference with named nested struct only
           Product: D
           Version: 1.005
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: manuelk89 at gmx.net
 BugsThisDependsOn: 340,810


Given a struct S in A.d and a template T int B.d with a nested struct
and S as its member:

// file A.d:

   import B;

   struct S { }

// file B.d:

   import A;

   struct T()
   {
      struct Nested
      {
         S member;
      }
   }

=========================================
Compiling with dmd 1.005 on winXP:

bud A

  Yields this:
    B.d(x): struct B.T!().T.Nested has forward references
    B.d(x): template instance B.T!() error instantiating

  But it compiles if...
    - you make 'Nested' an anonymous struct
    - you declare 'Nested' somewhere outside of 'T', even after the
      instantiation
    - you make 'member' a pointer or S a class
    - you change compile order, ie. 'bud B'
    - you put the instantiation below the declaration of S in A.d
    - you use dmd 0.177 (!)    

It still does not compile if 'Nested' is made a static struct.


-- 



More information about the Digitalmars-d-bugs mailing list