changeset 1612:081c48283153

Merge DMD r278: bugzilla 370 Compiler stack overflow on recursive... bugzilla 370 Compiler stack overflow on recursive typeof in function declaration. --- dmd/expression.c | 1 + dmd/mtype.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:21 -0300
parents 3f728445fc42
children 8f50a13d09a0
files dmd/expression.c dmd/mtype.c
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/expression.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/expression.c	Wed Jan 06 15:18:21 2010 -0300
@@ -2266,6 +2266,7 @@
 	if (!f->type->deco)
 	{
 	    error("forward reference to %s", toChars());
+	    return new ErrorExp();
 	}
 	return new VarExp(loc, f);
     }
--- a/dmd/mtype.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/mtype.c	Wed Jan 06 15:18:21 2010 -0300
@@ -3935,6 +3935,7 @@
 	if (exp->op == TOKtype)
 	{
 	    error(loc, "argument %s to typeof is not an expression", exp->toChars());
+	    goto Lerr;
 	}
 	t = exp->type;
 	if (!t)
@@ -3943,7 +3944,9 @@
 	    goto Lerr;
 	}
 	if (t->ty == Ttypeof)
-	    error(loc, "forward reference to %s", toChars());
+	{   error(loc, "forward reference to %s", toChars());
+	    goto Lerr;
+	}
     }
 
     if (idents.dim)
@@ -3972,7 +3975,7 @@
     return t;
 
 Lerr:
-    return tvoid;
+    return terror;
 }
 
 d_uns64 TypeTypeof::size(Loc loc)