Re: Class var in record breaks pointer cast

Martin Frb via fpc-pascal <[email protected]> Thu, 5 Feb 2026 15:54:04 +0100
Newsgroups gmane.comp.compilers.free-pascal.general
Message-ID <[email protected]>
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;

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal