A happy, successful and healthy New Year to everybody!

I have a generics related compilation issue in my package ExCtrls package (https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/exctrls/). This package contains a TCurrencySpinEditEx component which inherits from the TSpinEditExBase component of the LazControls package coming with Lazarus. TSpinEditExBase introduces generic fields FValue, FIncrement, FMaxValue etc, and each decendent of it specializes these types, i.e. in TCustomFloatSpinEditEx FValue, FIncrement, FMaxValue are double, and in the CurrencySpinEdit for the ExCtrls package they are currency values.

The compilation of the ExCtrls package fails for example in the IncrementStored method of TSpinEditExBase

    function TSpinEditExBase.IncrementStored: Boolean;
    begin
      Result := not SameValue(FIncrement, DefIncrement);   // <--- error here; SameValue is from unit Math
    end;

the error message says: "Can't determine which overloaded function to call". FIncrement and DefIncrement are generic types here.

What is strange to me is that the compilation issue does not happen with the LazControls package alone, but only when ExCtrls package is added.  Moreover, the problem occurs only on 64bit, not on 32 bit. (I am on Windows)

I can solve the compilation issue by moving the IncrementStored method into the derived classes. But this kind of contradicts the idea with using generic types in the first place.

Is there another way to solve this issue?

Werner


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to