From ddb0f3f209ed43ead6f53b27a291351bd81c5f0f Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 6 Jan 2010 15:18:21 -0300 Subject: [PATCH] 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(-) --- dmd/expression.c | 1 + dmd/mtype.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dmd/expression.c b/dmd/expression.c index 689c414c..67b90e60 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -2266,6 +2266,7 @@ Lagain: if (!f->type->deco) { error("forward reference to %s", toChars()); + return new ErrorExp(); } return new VarExp(loc, f); } diff --git a/dmd/mtype.c b/dmd/mtype.c index 02f29d92..0279b912 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -3935,6 +3935,7 @@ Type *TypeTypeof::semantic(Loc loc, Scope *sc) 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 @@ Type *TypeTypeof::semantic(Loc loc, Scope *sc) 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 @@ Type *TypeTypeof::semantic(Loc loc, Scope *sc) return t; Lerr: - return tvoid; + return terror; } d_uns64 TypeTypeof::size(Loc loc)