mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-28 09:33:27 +01:00
Merged 1.075 frontend.
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user