From 541330af1cb0870d8fb1fd5e65847e0c5f4a9c4e Mon Sep 17 00:00:00 2001 From: k-hara Date: Tue, 8 Nov 2011 19:46:09 +0900 Subject: [PATCH] 6870 additional - Fix null dereference problem --- src/mtype.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mtype.c b/src/mtype.c index d7accb2c6276..262dde481c8d 100644 --- a/src/mtype.c +++ b/src/mtype.c @@ -6352,7 +6352,6 @@ Type *TypeTypeof::semantic(Loc loc, Scope *sc) goto Lerr; } t = exp->type; - t = t->addMod(mod); if (!t) { error(loc, "expression (%s) has no type", exp->toChars()); @@ -6363,6 +6362,8 @@ Type *TypeTypeof::semantic(Loc loc, Scope *sc) goto Lerr; } + t = t->addMod(mod); + /* typeof should reflect the true type, * not what 'auto' would have gotten us. */