Skip to content

Generic result and nested functions

Original Reporter info from Mantis: okobapatino @OkobaPatino
  • Reporter name: OkobaPatino

Description:

When Test2 uses Test1, FPC can not compile TestFunction and raises error 2010021502. It may be related to #38209.
To reproduce, check out the attached project.

Unit1:

type

  { TTestRecord }

  TTestRecord<T> = record
    function TestFunction: T;
  end;

implementation

{ TTestRecord }

function TTestRecord<T>.TestFunction: T;
begin
end;    

Unit2:

function Test1<T>: TTestRecord<T>;
function Test2<T>: TTestRecord<T>;

implementation

function Test1<T>: TTestRecord<T>;
begin

end;

function Test2<T>: TTestRecord<T>;
begin
  Result := Test1<T>;
end;      

Mantis conversion info:

  • Mantis ID: 38216
  • Version: 3.2.1
  • Monitored by: » abouchez (Arnaud Bouchez), » @OkobaPatino (OkobaPatino)
Edited by Sven/Sarah Barth
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information