'Class property' cannot map itself to the field of a 'class var' record
Original Reporter info from Mantis: runewalsh
-
Reporter name:
Original Reporter info from Mantis: runewalsh
- Reporter name:
Description:
Code below should probably compile, but does not, both with classes and advanced records, and the error message is clearly wrong.
Note that non-static properties were always allowed to map themselves to the fields of the non-static records, and static properties work with “top-level” static variables (Option1 in the example).
Steps to reproduce:
{$mode objfpc}
type
Thing = class
class var
opt1: cardinal;
opts: record
opt2: cardinal;
end;
class property Option1: cardinal read opt1;
class property Option2: cardinal read opts.opt2;
end;
begin
Assert(Thing.Option1 = 0); // works
Assert(Thing.Option2 = 0); // Error: Operator is not overloaded: "Thing.<record type>" = "ShortInt"
end.
Mantis conversion info:
- Mantis ID: 38329
- Build: FPC 3.3.1-r47986 [2021/01/03]
- Version: 3.3.1