Well it's real ugly but here it is, I'm using extensive macros and lambdas so I can declare wrapper functions inline and I apologize for the messiness. The crash still happens without the lambda approach.
//these do lambda magic to allow the definition of wrappers inline
#define WRAPFUNC(ret, args, body) asFUNCTION(static_cast<ret(*)args>([]args -> ret body))
#define WRAPEXPR(ret, args, expr) WRAPFUNC(ret, args, {return expr;})
void registerVec()
{
r = engine->RegisterObjectType("vec", 0, asOBJ_REF | asOBJ_SCOPED); assert(r >= 0);
r = engine->RegisterObjectBehaviour("vec", asBEHAVE_FACTORY, "vec @f()", WRAPEXPR(vec*, (), new vec()), asCALL_CDECL); assert(r >= 0);
r = engine->RegisterObjectBehaviour("vec", asBEHAVE_FACTORY, "vec @f(const vec &in v)", WRAPEXPR(vec*, (const vec &o), new vec(o)), asCALL_CDECL); assert(r >= 0);
r = engine->RegisterObjectBehaviour("vec", asBEHAVE_FACTORY, "vec @f(float nx, float nx, float nz)", WRAPEXPR(vec*, (float x, float y, float z), new vec(x, y, z)), asCALL_CDECL); assert(r >= 0);
r = engine->RegisterObjectBehaviour("vec", asBEHAVE_FACTORY, "vec @f(float n)", WRAPEXPR(vec*, (float n), new vec(n)), asCALL_CDECL); assert(r >= 0);
r = engine->RegisterObjectBehaviour("vec", asBEHAVE_RELEASE, "void f()", WRAPFUNC(void, (vec* t), {if(t) { delete t; }}), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("vec", "vec &opAssign(const vec &in v)", asMETHODPR(vec, operator =, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec &opMulAssign(const float)", asMETHODPR(vec, operator *=, (const float), vec&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec &opDivAssign(const float)", asMETHODPR(vec, operator /=, (const float), vec&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec @opDiv(const float) const", WRAPEXPR(vec*, (float o, vec* v), new vec(*v / o)), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("vec", "vec @opMul(const float) const", WRAPEXPR(vec*, (float o, vec* v), new vec(*v * o)), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("vec", "bool opEquals(const vec &in v) const", asMETHODPR(vec, operator==, (const vec &) const, bool), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec &opAddAssign(const vec &in v)", asMETHODPR(vec, operator +=, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec &opSubAssign(const vec &in v)", asMETHODPR(vec, operator -=, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec &opMulAssign(const vec &in v)", asMETHODPR(vec, operator *=, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec &opDivAssign(const vec &in v)", asMETHODPR(vec, operator /=, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec @opDiv(const vec &in) const", WRAPEXPR(vec*, (const vec &vo, vec* v), new vec(*v / vo)), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("vec", "vec @opMul(const vec &in) const", WRAPEXPR(vec*, (const vec &vo, vec* v), new vec(*v * vo)), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("vec", "vec @opSub(const vec &in) const", WRAPEXPR(vec*, (const vec &vo, vec* v), new vec(*v - vo)), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("vec", "vec @opAdd(const vec &in) const", WRAPEXPR(vec*, (const vec &vo, vec* v), new vec(*v + vo)), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("vec", "void normalize()", asMETHOD(vec, normalize), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("vec", "vec @normalized()", WRAPEXPR(vec*, (vec* v), new vec(v->normalized())), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("vec", "float magnitude()", asMETHOD(vec, magnitude), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectProperty("vec", "float x", asOFFSET(vec, x)); assert( r >= 0 );
r = engine->RegisterObjectProperty("vec", "float y", asOFFSET(vec, y)); assert( r >= 0 );
r = engine->RegisterObjectProperty("vec", "float z", asOFFSET(vec, z)); assert( r >= 0 );
}