Ryan Joseph via fpc-pascal <fpc-pascal@lists.freepascal.org> schrieb am
Do., 28. Nov. 2019, 20:36:

> Testing on 3.3.1. Are these both bugs? I wanted to ask first before filing
> a report.
>
> {$mode objfpc}
>
> program test;
> uses
>   FGL;
>
> // No Error specializing TFPGList in parameter list...
> generic function CopyList<T>(source: specialize TFPGList<T>): specialize
> TFPGList<T>;
> begin
> end;
>
> // ... but getting an error specializing TFPGObjectList in parameter list
> // Class type expected, but got "T"
> generic function CopyList<T>(source: specialize TFPGObjectList<T>):
> specialize TFPGObjectList<T>;
> begin
> end;
>
> begin
> end.
>

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


> ===========================
>
> {$mode objfpc}
>
> program test;
> uses
>   FGL;
>
> // Type identifier expected
> // Internal error 2019112401
> generic function CopyList<T>(source: specialize FGL.TFPGObjectList<T>):
> specialize FGL.TFPGObjectList<T>;
> begin
> end;
>
> begin
> end.
>

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.

Regards,
Sven

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

Reply via email to