> On Nov 30, 2019, at 12:58 PM, Sven Barth via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> This can't work. ClassType is of type TClass and TClass.Create calls 
> TObject.Create, *not* the constructor of your list type, cause the 
> constructor chain is not virtual.
> 
> What you can do is this:
> 
> === code begin ===
> 
> generic function CopyList<T: TFPSList> (source: T): T;
> begin
>   result := T.Create;
>   result.Assign(source);
> end;
> 
> var
>   a, b: TNodeObjectList;
> begin
>   a := TNodeObjectList.Create;
>   b := specialize CopyList<TNodeObjectList>(a);
> end.
> 
> === code end ===

Found yet another internal compiler error trying your code:

https://bugs.freepascal.org/view.php?id=36388

The previous day was another internal compiler error with inline functions in 
case you missed it. ;)

https://bugs.freepascal.org/view.php?id=36381

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to