[fpc-pascal] Extraneous generic parameters

Sven Barth pascaldragon at googlemail.com
Mon Mar 15 07:42:39 CET 2021


Am 14.03.2021 um 19:10 schrieb Ryan Joseph via fpc-pascal:
> This program compiles, but is it a bug? I would think the specialization should fail because "S" in TArray is not specified.
>
> ========================
>
> {$mode objfpc}
>
> type
>    generic TArray<T, S> = array of T;
>    
> generic procedure DoThis<T>(param: specialize TArray<specialize TArray<T>>);
> begin
> end;
>
> begin
>    specialize DoThis<integer>([[1],[2],[3]]);
> end.

The TArray<T> generic type is part of the ObjPas unit, so the compiler 
simply picks that instead of that of your program. ;)

Regards,
Sven


More information about the fpc-pascal mailing list