[fpc-devel] (ref types / circles) Re: Defer keyword
Ryan Joseph
genericptr at gmail.com
Fri May 7 03:14:27 CEST 2021
> On May 6, 2021, at 5:41 PM, Martin Frb via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
>
> You can already cause ref circles, no classes needed.
>
> type
> TR = record
> a: array of TR;
> end;
>
> var
> x: TR;
> begin
> SetLength(x.a,99);
> x.a[0] := x;
> end.
This can be detected at compile and at least give a warning. "a" is a member of TR and the element type of "a" is TR, then we're assigning TR to said array. It's that simple I think.
Regards,
Ryan Joseph
More information about the fpc-devel
mailing list