From cae60aa4063368bd4d092aafed3294946d1f772c Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 6 Jan 2010 15:18:23 -0300 Subject: [PATCH] Merge DMD r324: bugzilla 3663 and 3664 - fwd ref regressions --- dmd/class.c | 2 +- dmd/enum.c | 4 +++- dmd/enum.h | 2 ++ dmd/mars.c | 2 +- dmd/struct.c | 5 ++++- 5 files changed, 11 insertions(+), 4 deletions(-) --- dmd/class.c | 2 +- dmd/enum.c | 4 +++- dmd/enum.h | 2 ++ dmd/mars.c | 2 +- dmd/struct.c | 5 ++++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dmd/class.c b/dmd/class.c index 5f0225e5..aa05771f 100644 --- a/dmd/class.c +++ b/dmd/class.c @@ -250,7 +250,7 @@ void ClassDeclaration::semantic(Scope *sc) return; } if (symtab) - { if (!scope) + { if (sizeok == 1 || !scope) { //printf("\tsemantic for '%s' is already completed\n", toChars()); return; // semantic() already completed } diff --git a/dmd/enum.c b/dmd/enum.c index b7f0f9ea..18f9063d 100644 --- a/dmd/enum.c +++ b/dmd/enum.c @@ -61,7 +61,7 @@ void EnumDeclaration::semantic(Scope *sc) memtype = Type::tint32; if (symtab) // if already done - { if (!scope) + { if (isdone || !scope) return; // semantic() already completed } else @@ -96,6 +96,8 @@ void EnumDeclaration::semantic(Scope *sc) memtype = Type::tint32; } + isdone = 1; + t = isAnonymous() ? memtype : type; symtab = new DsymbolTable(); sce = sc->push(this); diff --git a/dmd/enum.h b/dmd/enum.h index e67fd5a4..a08c01fe 100644 --- a/dmd/enum.h +++ b/dmd/enum.h @@ -42,6 +42,8 @@ struct EnumDeclaration : ScopeDsymbol Expression *defaultval; // default initializer #endif int isdeprecated; + int isdone; // 0: not done + // 1: semantic() successfully completed EnumDeclaration(Loc loc, Identifier *id, Type *memtype); Dsymbol *syntaxCopy(Dsymbol *s); diff --git a/dmd/mars.c b/dmd/mars.c index b0e50190..7961ed6f 100644 --- a/dmd/mars.c +++ b/dmd/mars.c @@ -58,7 +58,7 @@ Global::Global() copyright = "Copyright (c) 1999-2009 by Digital Mars and Tomas Lindquist Olsen"; written = "written by Walter Bright and Tomas Lindquist Olsen"; - version = "v1.054"; + version = "v1.055"; ldc_version = LDC_REV; llvm_version = LLVM_REV_STR; global.structalign = 8; diff --git a/dmd/struct.c b/dmd/struct.c index 5712e844..1d4f7ece 100644 --- a/dmd/struct.c +++ b/dmd/struct.c @@ -253,8 +253,11 @@ void StructDeclaration::semantic(Scope *sc) return; if (symtab) - { if (!scope) + { if (sizeok == 1 || !scope) + { //printf("already completed\n"); + scope = NULL; return; // semantic() already completed + } } else symtab = new DsymbolTable();