Hello, I am upgrading AngelScript on a game engine. I get an assertion failure strinkingly similar to this one.
I have AS_DEPRECATED set but I do not think it matters here.
Edit: Forgot to specify: amd64 linux with revision 2414 from SVN.
An assertion failure occurs in GetConstantDW.
../../source/as_compiler.cpp:15091: asDWORD asCExprValue::GetConstantDW(): Assertion `dataType.GetSizeInMemoryBytes() == 4' failed.
The backtrace is as it follows:
#6 0xf6bd685d in asCCompiler::CompileComparisonOperator(asCScriptNode*, asCExprContext*, asCExprContext*, asCExprContext*, eTokenType) ()
#7 0xf6bbeb5c in asCCompiler::CompileOperator(asCScriptNode*, asCExprContext*, asCExprContext*, asCExprContext*, eTokenType, bool) ()
#8 0xf6bb10c7 in asCCompiler::CompilePostFixExpression(asCArray<asCScriptNode*>*, asCExprContext*) ()
#9 0xf6bb1991 in asCCompiler::CompileExpression(asCScriptNode*, asCExprContext*) ()
#10 0xf6bb2ada in asCCompiler::CompileCondition(asCScriptNode*, asCExprContext*) ()
#11 0xf6bb3560 in asCCompiler::CompileAssignment(asCScriptNode*, asCExprContext*) ()
#12 0xf6be3172 in asCCompiler::CompileIfStatement(asCScriptNode*, bool*, asCByteCode*) ()
#13 0xf6be08d0 in asCCompiler::CompileStatementBlock(asCScriptNode*, bool, bool*, asCByteCode*) ()
#14 0xf6be0f48 in asCCompiler::CompileFunction(asCBuilder*, asCScriptCode*, asCArray<asCString>&, asCScriptNode*, asCScriptFunction*, sClassDeclaration*) ()
#15 0xf6b74520 in asCBuilder::CompileFunctions() ()
The script that triggers this is a comparison against a constant unsigned int:
const uint16 FREQUENCY = 2000;
/* ommitting some code */
void onTick(CBlob@ blob)
{
if (blob.getTickSinceCreated() < FREQUENCY) return;
/* ... */
}
blob.getTickSinceCreate() is returning an int. Removing the if condition makes the assertion failure go away.
I get the same failure with another script:
const u8 COIN_COST = 60;
void blah()
{
if(/* ... */ && player.getCoins() < COIN_COST) { /* ... */ }
}
I'd love to have this fixed. Thanks!