{ %NORUN } program tw31033; {$MODESWITCH RESULT} {$MODESWITCH ADVANCEDRECORDS} Type generic TGData = record public type // FIXME: Compiler bug, details see: // http://lists.freepascal.org/pipermail/fpc-pascal/2016-November/049444.html [^] TSelf = specialize TGData; PSelf = ^TSelf; public d: T; n: PSelf end; generic Function Init: specialize TGData.PSelf; forward; generic Function Init: specialize TGData.PSelf; Begin new(result); result^.d := default(T); result^.n := nil End; var t: ^specialize TGData; Begin t := specialize Init; dispose(t); End.