[fpc-devel] compiler has problem finding right function: IfThen (Math vs. StrUtils)
Michael Van Canneyt
michael at freepascal.org
Tue Jan 5 09:15:45 CET 2021
I did a small test, your program compiles with the trunk compiler ?
And I checked, the math IfThen() functions have overload attached.
What compiler did you use ?
Michael.
On Tue, 5 Jan 2021, Michael Van Canneyt via fpc-devel wrote:
>
> The ones in math must be marked with overload. Then the compiler will
> continue to search.
>
> Michael.
>
> On Tue, 5 Jan 2021, Pascal Riekenberg via fpc-devel wrote:
>
>> Please find a simple test project attached
>>
>> Note: If you put the StrUtils at the end of the uses list the program
> compiles.
>>
>>
>> Pascal
>>
>>> Pascal Riekenberg via fpc-devel <fpc-devel at lists.freepascal.org> hat
> am 05.01.2021 08:55 geschrieben:
>>>
>>>
>>> Since i updated my local fpc trunk some of my programs do not compile
> anymore. Version from before christmas was okay.
>>>
>>> The compiler can't find the function "IfThen(AValue: Boolean; const
> ATrue: string; const AFalse: string): string;" of StrUtils.
>>>
>>> Instead it only seems to see the functions in Math.
>>>
>>> SQLGenerator.pas(294,9) Error: Incompatible type for arg no. 3: Got
> "Char", expected "Double"
>>> math.pp(2523,10) Hint: Found declaration: IfThen(Boolean;const
> Double;const Double=` 0.00000000000000000000E+0000`):Double;
>>> math.pp(2518,10) Hint: Found declaration: IfThen(Boolean;const
> Int64;const Int64=`0`):Int64;
>>> math.pp(2513,10) Hint: Found declaration: IfThen(Boolean;const
> LongInt;const LongInt=`0`):LongInt;
>>> SQLGenerator.pas(299,9) Error: Incompatible type for arg no. 3: Got
> "Constant String", expected "Double"
>>> math.pp(2523,10) Hint: Found declaration: IfThen(Boolean;const
> Double;const Double=` 0.00000000000000000000E+0000`):Double;
>>> math.pp(2518,10) Hint: Found declaration: IfThen(Boolean;const
> Int64;const Int64=`0`):Int64;
>>> math.pp(2513,10) Hint: Found declaration: IfThen(Boolean;const
> LongInt;const LongInt=`0`):LongInt;
>>> SQLGenerator.pas(305,7) Error: Incompatible type for arg no. 3: Got
> "Constant String", expected "Double"
>>> math.pp(2523,10) Hint: Found declaration: IfThen(Boolean;const
> Double;const Double=` 0.00000000000000000000E+0000`):Double;
>>> math.pp(2518,10) Hint: Found declaration: IfThen(Boolean;const
> Int64;const Int64=`0`):Int64;
>>> math.pp(2513,10) Hint: Found declaration: IfThen(Boolean;const
> LongInt;const LongInt=`0`):LongInt;
>>> SQLGenerator.pas(442,60) Error: Incompatible type for arg no. 3: Got
> "Constant String", expected "Double"
>>> math.pp(2523,10) Hint: Found declaration: IfThen(Boolean;const
> Double;const Double=` 0.00000000000000000000E+0000`):Double;
>>> math.pp(2518,10) Hint: Found declaration: IfThen(Boolean;const
> Int64;const Int64=`0`):Int64;
>>> math.pp(2513,10) Hint: Found declaration: IfThen(Boolean;const
> LongInt;const LongInt=`0`):LongInt;
>>>
>>> If i qualify IfThen with "StrUtils." it compiles.
>>>
>>>
>>> Pascal
>>>
>>> _______________________________________________
>>> fpc-devel maillist - fpc-devel at lists.freepascal.org
>>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>>>
>>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
More information about the fpc-devel
mailing list