Sven, it would seem you cannot currently cannot pass a generic T to resolve the type of another generic subroutine.
In this example, Test<T> cannot reuse T in its call to Min<T>. I believe this line should be legal "Value := Min<T>(A, B);" (see the code below for context) Currently when you try to compile the unit GenericTest you'll receive a compiler error on line marked below. Would you like me to enter this into issue into mantis? unit GenericTest; {$mode delphi} interface function Min<T>(const A, B: T): T; function Max<T>(const A, B: T): T; procedure Test<T>(const A, B: T); implementation function Min<T>(const A, B: T): T; // Error on line below, GenericTest.pas(14,1) Error: Internal error 200301231 begin if A > B then Result := A else Result := B; end; function Max<T>(const A, B: T): T; begin if A > B then Result := A else Result := B; end; procedure Test<T>(const A, B: T); var Value: T; begin // This should be legal Value := Min<T>(A, B); WriteLn('The Min<T> of values, ', A, ' and ', B, ' are: ', Value); // As well as this Value := Max<T>(A, B); WriteLn('The Max<T> of values, ', A, ' and ', B, ' are: ', Value); end; end.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal