Merged DMD commit a10c791c2d6d29db8a4a91d20187636b035c2744:

bugzilla 5026 ICE(expression.c) Incomplete mixin expression + char[] to char assignment
This commit is contained in:
David Nadlinger
2011-04-22 15:49:51 +02:00
parent 2bc5cd5f1b
commit 7e053eaf9c
2 changed files with 12 additions and 3 deletions

View File

@@ -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);

View File

@@ -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)