On Sun, Feb 25, 2018 at 5:01 PM, Jonas Maebe <jo...@freepascal.org> wrote:
> As Michael said, overloads are selected at compile time. This is true for > both FPC and Delphi. We even have over a 100 unit tests that we ran under > Delphi to reverse engineer their selection priorities in case of variants: > https://svn.freepascal.org/svn/fpc/trunk/tests/test/cg/variants/ > > Abs(), however, gets a forced conversion to float in Delphi: > https://bugs.freepascal.org/view.php?id=20551 Hmm, did not find that one (I searched bugtracker before posting here). Seems you are right: Delphi Tokyo 10.2 X = -1 VarIsFloat : FALSE VarIsNumeric: TRUE VarIsOrdinal: TRUE After Abs() X = 1 VarIsFloat : TRUE VarIsNumeric: TRUE VarIsOrdinal: FALSE So, would it be possible to have an overloaded Abs(V: Variant): Variant; function in the variants unit? To be clear. Personally I don't need it (at least not ATM), I'm just curious. Thanks for explaining. Bart Bart _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel