Hi!
I recently made some changes to a script and caused a crash in the Build() function.
I made a very small test script to test it and sure enough I can reproduce it every time.
The only requirements are that you've registered a function using RegisterGlobalFunction. Just register a return type of bool and a single param, doesn't matter what type the param is.
For example:
bool MyCFunction(int aValue); // <- My function
engine->RegisterGlobalFunction("bool MyCFunction(int aValue)", asFUNCTION(MyCFunction), asCALL_CDECL); // The AS registration of the above function
And now use the following AngelScript code:
void main()
{
if (true and MyCFunction( SomethingUndefined ))
{
}
}
If you remove the "true and" from the front, it will work fine and generate an error without crashing. In my case it was actually another compare such as someVariable == 4, you just need a condition check before the call to the function.
If you define SomethingUndefined then there is no longer a crash, if you don't, there's a crash.
Callstack as follows (I trimmed the params so it fits in the post):
> MyExe.exe!_wassert Line 384 C
MyExe.exe!asCCompiler::ConvertToVariableNotIn Line 7481 + 0x26 bytes C++
MyExe.exe!asCCompiler::ConvertToVariable Line 7433 C++
MyExe.exe!asCCompiler::CompileBooleanOperator Line 8497 C++
MyExe.exe!asCCompiler::CompileOperator Line 7315 C++
MyExe.exe!asCCompiler::CompilePostFixExpression Line 5121 + 0x1e bytes C++
MyExe.exe!asCCompiler::CompileExpression Line 5080 + 0x10 bytes C++
MyExe.exe!asCCompiler::CompileCondition Line 5035 + 0x10 bytes C++
MyExe.exe!asCCompiler::CompileAssignment Line 4861 C++
MyExe.exe!asCCompiler::CompileIfStatement Line 2185 C++
MyExe.exe!asCCompiler::CompileStatement Line 1857 + 0x14 bytes C++
MyExe.exe!asCCompiler::CompileStatementBlock Line 607 C++
MyExe.exe!asCCompiler::CompileFunction Line 370 C++
MyExe.exe!asCBuilder::CompileFunctions Line 408 C++
MyExe.exe!asCBuilder::Build Line 169 C++
Let me know if you need anymore information.
Cliff :)