Skip to content

Implicit Specialization: Function type Matching not possible

Summary

The implicit specialization does not seem to be able to match function signatures correctly

System Information

Win 10: FPC Trunk/main

Example Project

program Project1;

{$mode objfpc}{$H+}
{$ModeSwitch implicitfunctionspecialization}

type
  generic TFunc<TResult> = function: TResult;

generic procedure Bar<T>(f: specialize TFunc<T>);
begin
end;

function Foo: Integer;
begin
end;

begin   
  specialize Bar<Integer>(@Foo); // works
  Bar(@Foo); // Error
end.

Project1.pas

Edited by Frederic Kehrein
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information