superobject icon indicating copy to clipboard operation
superobject copied to clipboard

superobject doesn't compile in Delphi 10.2 Tokyo

Open aflondono opened this issue 8 years ago • 2 comments

In Delphi 10.2 Tokyo, unit superobject.pas stops compiling, with error: "E2036 Variable required" on this line:

if CompareMem(@GetTypeData(TypeInfo).Guid, @soguid, SizeOf(TGUID)) then

This is located in procedure FromInterface inside function TSuperRttiContext.FromJson

This code compiled without issues in Delphi 10.1 Berlin.

I've fixed my local copy by declaring a new variable

var
  varGuid: TGUID;

and then using it like this:

varGuid := GetTypeData(TypeInfo).Guid;
if CompareMem(@varGuid, @soguid, SizeOf(TGUID)) then

and it seems to work correctly in my testing, but I am not sure if this is the correct solution in this case.

aflondono avatar May 05 '17 04:05 aflondono

You make copy of GUID record, this solution is imho syntactically correct but not optimal (unnecessary memory copying)

jaclas avatar May 15 '17 11:05 jaclas

you can change it like this

if isEqualGUID(GetTypeData(TypeInfo).Guid, soguid) then

a07272 avatar May 28 '17 18:05 a07272