   Compiler assertion
  Hi,I upgraded AS in my project to rev.644 and now whenever it compiles my script the compiler hits an assertion in as_compiler.cpp line 3599, at the start of function ImplicitConvPrimitiveToPrimitive().Unfortunately I have no idea what may cause this so I 'd like some help figuring it out...For the moment I have commented out that assert() line and my project works seemingly fine. There's surely a reason that assertion is there in the first place though and I only consider this commenting-out a hack until the real problem/solution is located.Thanks,Yiannis.   
  All my tests run without hitting this assert. You have a specific expression in a scenario that is not covered by my tests. If you can pinpoint which expression is hitting the assert I'll be able to fix it quickly.The first thing to do is to determine in which script function it happens. When the assert hits, check the name of the function that is being compiled. This can be seen in asCCompiler::outFunc. Once that is done it should be pretty simple to determine which expression it is.If you could also show me the callstack when the assert fails I may be able to figure out the scenario.;  Gladly I was able to come up with the simplest code that reproduces the problem:class Test{int State;void test(){switch (State){}}};void main(){Test t;t.test();}If I comment out the "switch" statement in Test::test() it compiles fine. As it is now it hits the assertion.Hope this helps,Yiannis.   ;Quote:Original post by WitchLordIf you could also show me the callstack when the assert fails I may be able to figure out the scenario.Sure, here:#0  0x00007ffff5677a75 in raise () from /lib/libc.so.6#1  0x00007ffff567b5c0 in abort () from /lib/libc.so.6#2  0x00007ffff5670941 in __assert_fail () from /lib/libc.so.6#3  0x00007ffff796b321 in asCCompiler::ImplicitConvPrimitiveToPrimitive (this=0x7fffffffdc60, ctx=0x7fffffffd610, toOrig=..., node=0x1035150, convType=asIC_IMPLICIT_CONV, generateCode=true, reservedVars=0x0) at engine/src/scripting/angelscript/src/as_compiler.cpp:3599#4  0x00007ffff796cef4 in asCCompiler::ImplicitConversion (this=0x7fffffffdc60, ctx=0x7fffffffd610, to=..., node=0x1035150, convType=asIC_IMPLICIT_CONV, generateCode=true, reservedVars=0x0, allowObjectConstruct=true) at engine/src/scripting/angelscript/src/as_compiler.cpp:3933#5  0x00007ffff7964f63 in asCCompiler::CompileSwitchStatement (this=0x7fffffffdc60, snode=0x10350b0, bc=0x7fffffffd800) at engine/src/scripting/angelscript/src/as_compiler.cpp:1975#6  0x00007ffff7964cd9 in asCCompiler::CompileStatement (this=0x7fffffffdc60, statement=0x10350b0, hasReturn=0x7fffffffda8e, bc=0x7fffffffd800) at engine/src/scripting/angelscript/src/as_compiler.cpp:1931#7  0x00007ffff795e7e0 in asCCompiler::CompileStatementBlock (this=0x7fffffffdc60, block=0xf01120, ownVariableScope=false, hasReturn=0x7fffffffda8e, bc=0x7fffffffda90) at engine/src/scripting/angelscript/src/as_compiler.cpp:630#8  0x00007ffff795d3ad in asCCompiler::CompileFunction (this=0x7fffffffdc60, builder=0x156eb00, script=0x156ec30, func=0x1034e10, outFunc=0x1570140) at engine/src/scripting/angelscript/src/as_compiler.cpp:316#9  0x00007ffff7941d4b in asCBuilder::CompileFunctions (this=0x156eb00) at engine/src/scripting/angelscript/src/as_builder.cpp:522#10 0x00007ffff794068d in asCBuilder::Build (this=0x156eb00) at engine/src/scripting/angelscript/src/as_builder.cpp:182#11 0x00007ffff799f1c1 in asCModule::Build (this=0x156e6b0) at engine/src/scripting/angelscript/src/as_module.cpp:142#12 0x00007ffff7932746 in CScriptBuilder::Build (this=0x7fffffffdfb0) at engine/src/scripting/angelscript/add-on/scriptbuilder/scriptbuilder.cpp:363#13 0x00007ffff7930fe2 in CScriptBuilder::BuildModule (this=0x7fffffffdfb0) at engine/src/scripting/angelscript/add-on/scriptbuilder/scriptbuilder.cpp:74Note I 'm on 64-bit, in case that matters.   ;  Fixed in revision 645.Commenting out the assert worked in your case because the ImplicitConversion didn't actually need to do anything. Thanks for the bug report.   ;  Thanks for the quick fix :)   