> On Nov 28, 2019, at 6:38 PM, Sven Barth via fpc-pascal > <fpc-pascal@lists.freepascal.org> wrote: > > TFPGObjectList has a constraint to class types, so you need to constrain your > T as well using ": class". > > Please note however that you'll likely encounter another bug then once you > move your function to a unit: https://bugs.freepascal.org/view.php?id=35943
A better error would be nice but I guess I can't do this anyways until the other bug is fixed. > The "specialize" is part of the generic identifier, so it must be > "FGL.specialize TFPGObjectList<T>". > > That said however an internal error should not happen (especially the one I > just added some days ago ^^'). Please report this one. > That doesn't look right to my eyes but ok. I filed a report (https://bugs.freepascal.org/view.php?id=36377). It looks like my plan was foiled so I made a non-generic attempt. Can you explain why I get the EListError at runtime? I checked the itemSize property and it's the same for both lists. {$mode objfpc} program test; uses FGL; type TNode = class (TInterfacedObject) end; TNodeObjectList = specialize TFPGInterfacedObjectList<TNode>; function CopyList (source: TFPSList): TFPSList; begin result := TFPSList(source.ClassType.Create); result.Assign(source); end; var a, b: TNodeObjectList; begin a := TNodeObjectList.Create; // EListError: Incompatible item size in source list b := CopyList(a) as TNodeObjectList; end. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal