Merged DMD commit 59d0f4b13384d656fdb66b2dc25c26e6b4cfa1ac:

bugzilla 4768 Regression(1.056): wrong code with forward declaration of enum
This commit is contained in:
David Nadlinger
2011-04-22 14:44:56 +02:00
parent def096c3ea
commit 8c7e196c3c

View File

@@ -4294,6 +4294,18 @@ Expression *TypeEnum::defaultInit(Loc loc)
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)
{
#ifdef DEBUG
printf("3: ");
#endif
error(loc, "enum %s is forward referenced", sym->toChars());
return 0;
}
return (sym->defaultval == 0);
}