Merge DMD r317: bugzilla 3611 Enum forward referencing regression

---
 dmd/enum.c  |   17 +++++++++++++++--
 dmd/mtype.c |    4 ++++
 2 files changed, 19 insertions(+), 2 deletions(-)
This commit is contained in:
Leandro Lucarella
2010-01-06 15:18:22 -03:00
parent 9ae38b1d03
commit edb33b00ee
2 changed files with 19 additions and 2 deletions

View File

@@ -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;

View File

@@ -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