[fpc-pascal] Local Type T and generics

Vojtěch Čihák vojtech.cihak at atlas.cz
Sat Dec 31 14:34:58 CET 2022


Hi,
 
I have local type TTempItem, i.e. declared inside method of a generic class.
When I write:
type 
     TTempItem = record
       Item: T;
       Empty: Boolean;
     end;
I got: Identifier not found "T".
 
When I write:
type
     TTempItem = record
       Item: TBaseGList.T;  //name of the class
       Empty: Boolean;
     end;
I got: Generics without  specialization cannot be used as a type for a variable
 
And finally
type TLocalT = T;
     TTempItem = record
       Item: TLocalT;
       Empty: Boolean;
     end;  
^^^ this works.
 
type TLocalT = TBaseGList.T;
     TTempItem = record
       Item: TLocalT;
       Empty: Boolean;
     end;  
^^^ work too.
 
Is this intended? Or known bug?
 
Thanks.
 
V.


More information about the fpc-pascal mailing list