[fpc-pascal] generic proc inference

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Oct 7 14:28:02 CEST 2019


On Mon, 7 Oct 2019 14:12:32 +0200
Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

>[...]
> > > > > generic function DoThis<T>(a: T): T; overload;
> > > > > begin end;
> > > > > generic function DoThis<T,U>(a: T): U; overload;
> > > > > begin end;
> > > > >
> > > > > begin
> > > > >  DoThis(3); // both fits, should give an error
> > > > > end;  
>[...]
> I'm also for an error.
> 
> However does Delphi pick a suitable non-generic overload  if one
> exists aside from the two generic ones?

Can you give an example what you mean?

Mattias


More information about the fpc-pascal mailing list