But same idea compiles without problems in Delphi.
This code is FPC compatible, just a little {$mode delphi} and System.SysUtils -> SysUtils renaming and you're done.
The delphi code? yes! Just what you wrote.
Indeed. Note that rtl-generics is trunk. There is a 3.0.4. version available as separate download from the author.
In general I strongly advice to use mode delphi if you are coming from delphi and NOT mode objfpc. It has no real advantages and makes porting unnecessary difficult.
The limit is here in FGL. Not a bug but a declared limitation. FGL is not delphi compatible. rtl-generics is largely delphi compatible and even includes extra's.
So: use mode delphi and use rtl-generics. Not mode objfpc and fgl.