> On Mar 7, 2020, at 5:15 AM, Sven Barth <pascaldra...@googlemail.com> wrote: > > I've found two bug reports related to this (I searched for "property" and > only those reports that are neither closed nor resolved): > - https://bugs.freepascal.org/view.php?id=23620 > - https://bugs.freepascal.org/view.php?id=14534 > > And I noticed that the following already does generate an error:
Yes, you're right this does trigger the correct error. My example was actually bad because I didn't notice that my problem was coming from a more complex situation. Given the code I get no error because the "width" property of the helper is writeable but the "point" property is read-only. This should still give the error because even though "width" is writable the "point" is read-only and the assignment will still go to temporary memory, thus failing silently. Should I file a new bug report for this? ==================== {$mode objfpc} {$modeswitch advancedrecords} program test; type TPoint = record x, y: integer; end; type TSizeHelper = record helper for TPoint procedure SetWidth(newValue: integer); inline; procedure SetHeight(newValue: integer); inline; function GetWidth: integer; inline; function GetHeight: integer; inline; property Width: integer read GetWidth write SetWidth; property Height: integer read GetHeight write SetHeight; end; procedure TSizeHelper.SetWidth(newValue: integer); begin x := newValue; end; procedure TSizeHelper.SetHeight(newValue: integer); begin y := newValue; end; function TSizeHelper.GetWidth: integer; begin result := x; end; function TSizeHelper.GetHeight: integer; begin result := y; end; type TThing = record m_point: TPoint; function GetPoint: TPoint; property point: TPoint read GetPoint; end; function TThing.GetPoint: TPoint; begin result := m_point; end; var t: TThing; begin // no error! t.point.width := 0; end. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal