On Sun, 6 Oct 2019 18:16:16 -0400 Ryan Joseph <generic...@gmail.com> wrote:
>[...] > >>> 3. > >>> timpfuncspez2.pp > >>> DoThis<T> > >>> DoThis<T,U> > >>> Delphi gives an error "Ambiguous call to DoThis". FPC silently > >>> selects the one with only one param. IMO this is dangerous, it > >>> should give an error. > > > > 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 gave a bad example. Here is a better one: generic procedure DoThis<T>(a: T; b:T); overload; begin end; generic procedure DoThis<T,U>(a: T; b:U); overload; begin end; begin DoThis(1,2); end; fpc selects second, but IMO should give an error . Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal