View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038329 | FPC | Compiler | public | 2021-01-08 00:15 | 2021-02-27 22:13 |
Reporter | runewalsh | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 3.3.1 | ||||
Summary | 0038329: 'Class property' cannot map itself to the field of a 'class var' record | ||||
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. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
|
Any thoughts on this extremely severe and important defect... |
|
This is Delphi compatible. http://docwiki.embarcadero.com/RADStudio/Rio/en/E2459_Class_property_accessor_must_not_have_field_selector_(Delphi) |
|
At least it should have a proper error message then. But I don't see why this should be forbidden when instance properties are allowed to have field selectors. Not sure if it can be done easily, but if it can, allowing this won't really be incompatible, at least one-directionally. I believe FPC already has things allowed even in $MODE DELPHI that Delphi himself does not understand? |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-01-08 00:15 | runewalsh | New Issue | |
2021-02-27 20:19 | runewalsh | Note Added: 0129210 | |
2021-02-27 21:12 | Serge Anvarov | Note Added: 0129212 | |
2021-02-27 22:00 | runewalsh | Note Added: 0129214 | |
2021-02-27 22:04 | runewalsh | Note Edited: 0129214 | View Revisions |
2021-02-27 22:05 | runewalsh | Note Edited: 0129214 | View Revisions |
2021-02-27 22:13 | runewalsh | Note Edited: 0129214 | View Revisions |