Thread overview
[Issue 2386] New: Array of forward referenced struct doesn't compile
Oct 02, 2008
d-bugmail
Mar 27, 2010
Rainer Schuetze
May 10, 2010
Walter Bright
October 02, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2386

           Summary: Array of forward referenced struct doesn't compile
           Product: D
           Version: 2.019
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: terranium@yandex.ru
OtherBugsDependingO 340
             nThis:


struct BB
{
  Item[1] aa; //struct tmp.Item no size yet for forward reference
}

struct CC
{
  Item aa; //ok
}

struct Item
{
  byte data;
}


-- 

March 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2386


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario@gmx.de


--- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2010-03-27 06:17:13 PDT ---
Here's a patch that simply invokes the semantics of the forward referenced struct.

Index: struct.c ===================================================================
--- struct.c    (revision 421)
+++ struct.c    (working copy)
@@ -115,6 +115,8 @@
     //printf("AggregateDeclaration::size() = %d\n", structsize);
     if (!members)
     error(loc, "unknown size");
+    if (sizeok != 1 && scope)
+    semantic(NULL);
     if (sizeok != 1)
     {    error(loc, "no size yet for forward reference");
     //*(char*)0=0;


This patch also fixes #2654

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2386


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2010-05-10 13:39:09 PDT ---
changeset 429

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2386


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bearophile_hugs@eml.cc
         Resolution|                            |FIXED


--- Comment #3 from bearophile_hugs@eml.cc 2010-05-15 17:53:20 PDT ---
This is fixed in v2.046 and v1.061.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------