The function Bind is specialized with two types which are identical 
(TState<Integer>) and the compiler can’t determine which to call. 

Is there anyway to resolve this? In my mind I want the more “explicit” overload 
with the var parameter but there’s really no way for the compiler to know this, 
that I can think of anyways.

========================================

{$mode objfpc}
{$modeswitch implicitfunctionspecialization}

program test;

type
  generic TState<T> = class
  end;

generic procedure Bind<T>(value: T);
begin
end;

generic procedure Bind<T>(var state: specialize TState<T>);
begin
end;

var
  state: specialize TState<Integer>;
begin
  Bind(state); // Error: Can't determine which overloaded function to call
end.

Regards,
        Ryan Joseph

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to