[Issue 4516] Regression(2.040): forward declaration of enum not supported

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 6 02:23:33 PDT 2010


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Summary|forward declaration of enum |Regression(2.040): forward
                   |not supported               |declaration of enum not
                   |                            |supported


--- Comment #4 from Don <clugdbug at yahoo.com.au> 2010-08-06 02:23:31 PDT ---
The fix to bug 1160 was what originally fixed it (in toBasetype(), do full
semantic on the enum type when forward referenced); the fix to bug 3723 broke
it again (in toBasetype(), only do semantic on the type, not on the full enum).
In this situation, it does actually does the need the full semantic to be run.

Although this test case passes in D1, I'm not convinced that D1 is correct (it
doesn't check for forward references at all).
----
PATCH: mtype.c, line 6340.

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

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


More information about the Digitalmars-d-bugs mailing list