[fpc-pascal] Two possible generics bugs
Sven Barth
pascaldragon at googlemail.com
Mon Dec 2 14:47:56 CET 2019
Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mo., 2. Dez. 2019, 14:01:
>
>
> > On Nov 30, 2019, at 12:58 PM, Sven Barth via fpc-pascal <
> fpc-pascal at 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.
>
> Ok, so if the constructor was virtual this would work as expected? I guess
> that make sense.
>
In this specific case: not really. Because TFPSList has a different
constructor signature than TFPGList<>. And even then you'd need to cast
ClassType to a "class of TFPSList" type as TObject.Create is never virtual.
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20191202/6f85b5be/attachment.html>
More information about the fpc-pascal
mailing list