[fpc-pascal] Class var in record breaks pointer cast

Martin Frb lazarus at mfriebe.de
Thu Feb 5 15:54:04 CET 2026


On 05/02/2026 15:45, Martin Frb via fpc-pascal wrote:
>
>>
>>>
>>> type
>>>   TMyRec = record
>>>     class var z: UInt32;
>>>     x, y: UInt32;
>>>   end;




Ok found something...

I tried debugging, and noted that with the class var, the record had no 
debug info for any field.
And expecting memory did not reveal any data, if wrote to other fields.

"class var" seems to start a section, like "public type"

So all 3 fields in your example are class vars.

Try the below:

type
   TMyRec = record
     class var
        z: UInt32;
     var  // new section, normal fields // tested 3.3.1
       x, y: UInt32;
   end;



More information about the fpc-pascal mailing list