diff --git a/dmd/enum.c b/dmd/enum.c index 94199000..b7f0f9ea 100644 --- a/dmd/enum.c +++ b/dmd/enum.c @@ -57,10 +57,23 @@ void EnumDeclaration::semantic(Scope *sc) Scope *sce; //printf("EnumDeclaration::semantic(sd = %p, '%s')\n", sc->scopesym, sc->scopesym->toChars()); - if (symtab) // if already done - return; if (!memtype) memtype = Type::tint32; + + if (symtab) // if already done + { if (!scope) + return; // semantic() already completed + } + else + symtab = new DsymbolTable(); + + Scope *scx = NULL; + if (scope) + { sc = scope; + scx = scope; // save so we don't make redundant copies + scope = NULL; + } + if (sc->stc & STCdeprecated) isdeprecated = 1; diff --git a/dmd/mtype.c b/dmd/mtype.c index 1906a4fe..4de5e254 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -4065,6 +4065,10 @@ Dsymbol *TypeEnum::toDsymbol(Scope *sc) Type *TypeEnum::toBasetype() { + if (sym->scope) + { + sym->semantic(NULL); // attempt to resolve forward reference + } if (!sym->memtype) { #ifdef DEBUG