Merged 1.075 frontend.

This commit is contained in:
David Nadlinger
2012-11-24 20:58:26 +01:00
parent 2d02270434
commit 288fd47707
49 changed files with 2306 additions and 2082 deletions

View File

@@ -1,5 +1,5 @@
// Copyright (c) 1999-2011 by Digital Mars
// Copyright (c) 1999-2012 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
@@ -54,10 +54,14 @@ void StaticAssert::semantic2(Scope *sc)
{
//printf("StaticAssert::semantic2() %s\n", toChars());
Expression *e = exp->semantic(sc);
if (e->type == Type::terror)
if (!e->type->checkBoolean())
{
if (e->type->toBasetype() != Type::terror)
exp->error("expression %s of type %s does not have a boolean value", exp->toChars(), e->type->toChars());
return;
}
unsigned olderrs = global.errors;
e = e->optimize(WANTvalue | WANTinterpret);
e = e->ctfeInterpret();
if (global.errors != olderrs)
{
errorSupplemental(loc, "while evaluating: static assert(%s)", exp->toChars());
@@ -69,7 +73,7 @@ void StaticAssert::semantic2(Scope *sc)
OutBuffer buf;
msg = msg->semantic(sc);
msg = msg->optimize(WANTvalue | WANTinterpret);
msg = msg->ctfeInterpret();
hgs.console = 1;
msg->toCBuffer(&buf, &hgs);
error("%s", buf.toChars());