- fixed: Getting the offset to the 'Size' field for static arrays should use a fixed offset, not the size of the defining variable, which, depending on where things are defined, can be different.

This commit is contained in:
Christoph Oelckers 2017-03-13 20:27:46 +01:00
parent cc60b005a1
commit 6037ecb6a1

View file

@ -8104,7 +8104,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
if (Self->ExprType == EFX_StructMember || Self->ExprType == EFX_ClassMember || Self->ExprType == EFX_GlobalVariable) if (Self->ExprType == EFX_StructMember || Self->ExprType == EFX_ClassMember || Self->ExprType == EFX_GlobalVariable)
{ {
auto member = static_cast<FxMemberBase*>(Self); auto member = static_cast<FxMemberBase*>(Self);
auto newfield = new PField(NAME_None, TypeUInt32, VARF_ReadOnly, member->membervar->Offset + member->membervar->Type->Align); // the size is stored right behind the pointer. auto newfield = new PField(NAME_None, TypeUInt32, VARF_ReadOnly, member->membervar->Offset + sizeof(void*)); // the size is stored right behind the pointer.
member->membervar = newfield; member->membervar = newfield;
Self = nullptr; Self = nullptr;
delete this; delete this;