- unary minus operator propagates boolean operand to integer

https://forum.zdoom.org/viewtopic.php?t=63214
This commit is contained in:
alexey.lysiuk 2019-01-10 13:05:35 +02:00 committed by Christoph Oelckers
parent 4126f8ce72
commit 21531c5ddb
1 changed files with 6 additions and 0 deletions

View File

@ -1881,6 +1881,12 @@ FxExpression *FxMinusSign::Resolve(FCompileContext& ctx)
delete this;
return e;
}
else if (Operand->ValueType == TypeBool)
{
Operand = new FxIntCast(Operand, true);
Operand = Operand->Resolve(ctx);
assert(Operand != nullptr);
}
ValueType = Operand->ValueType;
return this;
}