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. */