Cannot assign Method to Function References with Generic Return
Summary
The compiler does not recognize the function signature is the same for functions which use generic specialization in their return value
System Information
FPC Trunk on Linux x64
Steps to reproduce
Example Project
program Project1;
{$mode objfpc}{$H+}
{$ModeSwitch functionreferences}
type
generic TMyClass<T> = class
public type
tmyfun = reference to function: specialize TArray<T>;
public
f: tmyfun;
function fun: specialize TArray<T>;
constructor Create;
end;
function TMyClass.fun:specialize TArray<T>;
begin
end;
constructor TMyClass.Create;
begin
f := @fun; // project1.lpr(25,8) Error: Incompatible types: got "<procedure variable type of function:{Dynamic} Array Of TMyClass$1.T of object;Register>" expected "TMyClass$1.TMYFUN"
end;
begin
end.Edited by Frederic Kehrein