diff --git a/dmd/expression.c b/dmd/expression.c index 6569de4c..53f70520 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -5153,11 +5153,15 @@ Expression *CompileExp::semantic(Scope *sc) #endif UnaExp::semantic(sc); e1 = resolveProperties(sc, e1); + if (!e1->type->isString()) + { + error("argument to mixin must be a string type, not %s\n", e1->type->toChars()); + return new ErrorExp(); + } e1 = e1->optimize(WANTvalue | WANTinterpret); if (e1->op != TOKstring) { error("argument to mixin must be a string, not (%s)", e1->toChars()); - type = Type::terror; - return this; + return new ErrorExp(); } StringExp *se = (StringExp *)e1; se = se->toUTF8(sc); diff --git a/dmd/func.c b/dmd/func.c index b17631fd..6bf8da02 100644 --- a/dmd/func.c +++ b/dmd/func.c @@ -700,6 +700,7 @@ void FuncDeclaration::semantic3(Scope *sc) { TypeFunction *f; VarDeclaration *argptr = NULL; VarDeclaration *_arguments = NULL; + int nerrors = global.errors; if (!parent) { @@ -1512,7 +1513,11 @@ void FuncDeclaration::semantic3(Scope *sc) sc2->callSuper = 0; sc2->pop(); } - semanticRun = PASSsemantic3done; + + if (global.gag && global.errors != nerrors) + semanticRun = PASSsemanticdone; // Ensure errors get reported again + else + semanticRun = PASSsemantic3done; } void FuncDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)