When registering a specialized array type twice I get an ACCESS VIOLATION.
engine->RegisterObjectType("array<int32>", 0, asOBJ_REF);
engine->RegisterObjectType("array<int>", 0, asOBJ_REF);
as_scriptengine.cpp: 1699
// Was the template instance type created before?
if( templateInstanceTypes[templateInstanceTypes.GetLength()-1] == mostRecentTemplateInstanceType ||
mostRecentTemplateInstanceType == dt.GetObjectType() )
// TODO: Should have a better error message
return ConfigError(asNOT_SUPPORTED, "RegisterObjectType", name, 0);
templateInstanceTypes has a length of 0, so templateInstanceTypes[-1] produces the error.
The following modification seems to correct the issue. Please confirm.
// Was the template instance type created before?
if( templateInstanceTypes.GetLength() == 0 ||
templateInstanceTypes[templateInstanceTypes.GetLength()-1] == mostRecentTemplateInstanceType ||
mostRecentTemplateInstanceType == dt.GetObjectType() )
// TODO: Should have a better error message
return ConfigError(asNOT_SUPPORTED, "RegisterObjectType", name, 0);