by _mental_ » Wed Jan 09, 2019 8:06 am
Loading the following ZScript will trigger an assertion failure
here:
ValueType is "Int" while
Operand->ValueType is "Bool".
Code: Select all
class UnaryMinusBool : Actor
{
states
{
spawn:
TNT1 A 1
{
bool a = false;
int i = -a;
bool b = true;
int j = -b;
console.printf("%i %i", i, j);
}
}
}
Generated code seems to be correct. The sample outputs expected values, 0 and -1.
I suspect the assertion's condition is too strict and doesn't take bool-to-int type propagation into account.
Loading the following ZScript will trigger an assertion failure [url=https://github.com/coelckers/gzdoom/blob/cf967b36ffe0abb3da6da99a408a76c4d2d88373/src/scripting/backend/codegen.cpp#L1903]here[/url]: [b]ValueType[/b] is "Int" while [b]Operand->ValueType[/b] is "Bool".
[code]class UnaryMinusBool : Actor
{
states
{
spawn:
TNT1 A 1
{
bool a = false;
int i = -a;
bool b = true;
int j = -b;
console.printf("%i %i", i, j);
}
}
}[/code]
Generated code seems to be correct. The sample outputs expected values, 0 and -1.
I suspect the assertion's condition is too strict and doesn't take bool-to-int type propagation into account.