diff --git a/dmd/mtype.c b/dmd/mtype.c index 11101631..40f04a71 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -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); }