www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4768] New: Regression(1.056): wrong code with forward declaration of enum

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4768

           Summary: Regression(1.056): wrong code with forward declaration
                    of enum
           Product: D
           Version: D1
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2010-08-29 23:57:56 PDT ---
This is the D1 version of bug 4516.

Rejected as 'forward reference error' up to D1.053.
Worked correctly in 1.054 and 1.055. Wrong code in 1.056 and later.
Works if the definition of B is moved above A.

struct A { B b; }
enum B { Z = 2 }

void main()
{
   A x;
   assert(x.b == 2);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 29 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4768


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-09-13 16:39:04 PDT ---
mtype.c, line 4110. Basically the same patch as bug 4516.

int TypeEnum::isZeroInit(Loc loc)
{
+    if (!sym->isdone && sym->scope)
+    {   // Enum is forward referenced. We need to resolve the whole thing.
+       sym->semantic(NULL);
+    }
+    if (!sym->isdone)
+    {
+        error(loc, "enum %s is forward referenced", sym->toChars());
+        return 0;
+    }
    return (sym->defaultval == 0);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 13 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4768


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2010-09-21
19:21:45 PDT ---
http://www.dsource.org/projects/dmd/changeset/682

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