[fpc-pascal] generic proc inference

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


On Mon, 7 Oct 2019 15:37:46 +0200 (CEST)
Michael Van Canneyt <michael at freepascal.org> wrote:

>[...]
> > You mean, if a bad overload can be nullified by a good one? That
> > would be insane...
> >
> > Yes, Delphi eats it without warning.
> >
> > And it works even with a generic param:
> >
> > generic function Run<T,U>(a: T; b: U): T; overload;
> > begin end;
> > generic function Run<T>(a: T; b: word): T; overload;
> > begin end;
> >
> > Run(3,word(4));  
> 
> So do I understand you correctly and Delphi's behaviour is
> insane ? :-)

Yes.
Maybe it's just me, every day learning more ugly details of Delphi
inference rules.

Mattias


More information about the fpc-pascal mailing list