Angelscript does not seem to be able to properly call the copy constructor of a simple POD type that is being returned from a registered global function for some reason. When it does call the copy constructor, the this pointer of the new object is null, but the input variable has a valid address from the c++ function. I'm using version 2.31.0 WIP.
The problem seems to be around line 1097 in as_callfunc_x86.cpp:
// Copy return value from EAX:EDX
lea ecx, retQW
mov [ecx], eax
mov 4[ecx], edx
My C++ code:
PointF Instance::GetBodyPos()
{
PointF pos;
if (pBody)
{
pos.Set( pBody->GetPosition().x*MTP_RATIO, pBody->GetPosition().y*MTP_RATIO);
}
return pos; //<------------- Crashes on return. pos gets passed in correctly though
}