changeset 1623:1d48eced441f

Merge DMD r317: bugzilla 3611 Enum forward referencing regression --- dmd/enum.c | 17 +++++++++++++++-- dmd/mtype.c | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:22 -0300
parents a542ef277a84
children ae8a94d87ca9
files dmd/enum.c dmd/mtype.c
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/enum.c	Wed Jan 06 15:18:22 2010 -0300
+++ b/dmd/enum.c	Wed Jan 06 15:18:22 2010 -0300
@@ -57,10 +57,23 @@
     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;
 
--- a/dmd/mtype.c	Wed Jan 06 15:18:22 2010 -0300
+++ b/dmd/mtype.c	Wed Jan 06 15:18:22 2010 -0300
@@ -4065,6 +4065,10 @@
 
 Type *TypeEnum::toBasetype()
 {
+    if (sym->scope)
+    {
+	sym->semantic(NULL);	// attempt to resolve forward reference
+    }
     if (!sym->memtype)
     {
 #ifdef DEBUG