On Mon, 7 Oct 2019, Mattias Gaertner via fpc-pascal wrote:
On Mon, 7 Oct 2019 14:12:32 +0200
Sven Barth via fpc-pascal <fpc-pascal@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?
I think sven means if you have e.g. 3 functions:
generic function DoThis<T>(a: T): T; overload;
begin end;
generic function DoThis<T,U>(a: T): U; overload;
begin end;
function DoThis(aInt : Integer) : Integer;
begin
end;
Should the compiler choose the 3rd non-generic function, or still give an
error ?
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal