{ %NORUN } { overloads with other generic functions work correctly } program tgenfunc8; {$mode objfpc} operator := (aOther: LongInt): String; begin Str(aOther, Result); end; operator := (aOther: String): LongInt; var code: LongInt; begin Val(aOther, Result, code); end; generic function Add(aLeft, aRight: T): T; begin Result := aLeft + aRight; end; generic function Add(aLeft, aRight: S): T; begin Result := aLeft + aRight; end; generic function Add(aLeft: T): T; begin Result := aLeft + aLeft; end; begin Writeln(specialize Add(4, 5)); Writeln(specialize Add(3, 8)); Writeln(specialize Add('3', '8')); Writeln(specialize Add(2)); Writeln(specialize Add('Test')); end.