mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-14 11:53:13 +01:00
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:
17
dmd/enum.c
17
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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user