FPC generics: circular type reference? lazarus / 62-General ---------------------------------------------------------------------- serge_t · 2015-03-10 15:24 Hello, Is it possible to implement the circular type reference within the generic type? Following example doesn't compile with FPC 2.6.4 (Lazarus 1.2.6 Win32). Code: [Select]  generic TGItem = class   private type     TGItemSpec = specialize TGItem;   private var     FValue: T;     FLeft, FRight: TGItemSpec;   public     property Value: T read FValue write FValue;   end; Code: [Select]project1.lpr(7,29) Error: Illegal expression project1.lpr(7,35) Error: Specialization is only supported for generic types ---------------------------------------------------------------------- Blaazen · 2015-03-10 16:20 Your code compiles well in 3.1.1 (only Note: private fields FLeft, FRight never used). There were many generic improvements that are not included in 2.6.4 yet. Use trunk or wait for fpc 3.0. ---------------------------------------------------------------------- serge_t · 2015-03-10 16:30 Thank for response. Is it possible to use FPC 3.x with Lazarus? We have many applications built with LCL so migrating is required in this case. ---------------------------------------------------------------------- Blaazen · 2015-03-10 17:09 Yes, Lazarus trunk works with FPC trunk. See my footer: Lazarus 1.5 r48240M FPC 3.1.1 30069 x86_64 ---------------------------------------------------------------------- serge_t · 2015-03-11 09:47 Ok, we will waiting for 1.5 release  P.S. Generic tree implementation for FPC 2.6.4 without circular type references is here http://arbinada.com/main/node/1430