[fpc-devel] When will the next version of FPC be released?

Ryan Joseph genericptr at gmail.com
Sat Jun 1 17:34:05 CEST 2019



> On Jun 1, 2019, at 6:00 AM, Michael Van Canneyt <michael at freepascal.org> wrote:
> 
> I don't think this syntax is a good idea.
> 
> What with overloads ?
> 
> Procedure MyProc<T>(a:T);
> Procedure MyProc(a : TObject);

Currently the non-generic gets called in this situation. That’s because non-generic procedures take precedence and TMyClass can be passed to TObject. That’s pretty simple right?

{$mode objfpc}
{$modeswitch implicitfunctionspecialization}

program timpfuncspez14;

type
  TMyClass = class
  end;

procedure DoThis(msg: TObject);
begin
  writeln('DoThis:',msg.ClassName);
end;

generic procedure DoThis<T>(msg: T);
begin
  writeln('DoThis<T>:',msg.ClassName);
end;

begin
  DoThis(TMyClass.Create);
  DoThis(TObject.Create);
end.

Regards,
	Ryan Joseph




More information about the fpc-devel mailing list