[fpc-devel] Overloading problem in generic class.

Martin Frb lazarus at mfriebe.de
Sun Sep 18 13:34:45 CEST 2022

On 18/09/2022 11:37, Bart via fpc-devel wrote:
> Hi,
> The following program will compile for Windows 32 and 64 bit.
> It fails to compile for Linix 64 bit (and if I understand correctly,
> also for MacOS 64 bit).

Just enable fpc_math_samevalue_bug

{$if FPC_FullVersion=30202}{$ifdef Win64}
   {$define fpc_math_samevalue_bug}

Make it
{$if FPC_FullVersion<=30202}
   {$define fpc_math_samevalue_bug}

I wonder anyway

   TCustomSpinEditEx = class(specialize TSpinEditExBase<Int64>)

But "SameValue" does not exist for int64 (or any int)?
So I assume the compiler converts the int to a float for calling 
SameValue => that seems undesirable.

So we should have a function (in the scope for the generic)

     function SameValue(AValue1, AValue2: Int64): Boolean; overload;

More information about the fpc-devel mailing list