> On Jun 1, 2021, at 12:20 PM, denisgolovan via fpc-pascal > <fpc-pascal@lists.freepascal.org> wrote: > > Hi all > > I am trying to implement Option<T> type in FPC. > > type > generic TOption<T> = record > case IsSome:boolean of > true: ( some: T ); > false: (); > end;
You need to use a constraint like: type generic TOption<T: TObject> = record case IsSome:boolean of true: ( some: T ); false: (); end; Not sure why though. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal