Class var in record breaks pointer cast
Hairy Pixels via fpc-pascal <[email protected]> Thu, 5 Feb 2026 05:34:41 -0800
| Newsgroups | gmane.comp.compilers.free-pascal.general |
|---|---|
| Message-ID | <CAGsUGtnshuvAPYpCnRMbHuLO4cFZAqNxeLANzMTLvHT58A3KPQ@mail.gmail.com> |
Is this a bug? Adding the class var field changes prints 0 and without it
prints 100 as expected. The class var is just a static field that isn't
actually part of the record so how could it affect the memory layout?
type
TMyRec = record
class var z: UInt32;
x, y: UInt32;
end;
var
r: TMyRec;
p: pointer;
begin
r.x := 100;
p := @r;
writeln(PUInt32(p)^);
end.
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal