Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-01

compiler has problem finding right function: IfThen (Math vs. StrUtils)

8 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pascal Riekenberg

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

Reply by email

Pascal Riekenberg
to Pascal Riekenberg

Please find a simple test project attached

Note: If you put the StrUtils at the end of the uses list the program compiles.

Pascal

Show quoted text 35 lines
Pascal Riekenberg via fpc-devel 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 - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Michael Van Canneyt
to Pascal Riekenberg

The ones in math must be marked with overload. Then the compiler will continue to search.

Michael.

Pascal Riekenberg wrote 43 lines
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 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 - > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >

Reply by email

Michael Van Canneyt
to Michael Van Canneyt

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.

Michael Van Canneyt wrote 75 lines
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 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 - >> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >> > _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Pascal Riekenberg
to Michael Van Canneyt
Michael Van Canneyt via fpc-devel hat am 05.01.2021 09:15 geschrieben: I did a small test, your program compiles with the trunk compiler ?

No, only if you put StrUtils at the end of the uses list.

And I checked, the math IfThen() functions have overload attached.

Both units have "overload"!

What compiler did you use ?

trunk, r48021

Reply by email

Michael Van Canneyt
to Pascal Riekenberg
Pascal Riekenberg wrote 14 lines
> Michael Van Canneyt via fpc-devel hat am 05.01.2021 09:15 geschrieben: > > > I did a small test, your program compiles with the trunk compiler ? No, only if you put StrUtils at the end of the uses list. > And I checked, the math IfThen() functions have overload attached. Both units have "overload"! > What compiler did you use ? trunk, r48021

Mine is a little older, so it must be a recent change.

I think you better file a bugreport.

Michael.

Reply by email

Werner Pamler
to Pascal Riekenberg: Since i updated my local fpc trunk some of my programs do not compile anymore. Version…
Pascal Riekenberg wrote 43 lines
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.

I had the same issue with TAChart yesterday and could only solve it by qualifying each IfThen with the corresponding unit. It only happens on 64-bit. I bisected the revisions and found the guilty one in r48002 by Sven Barth:

"Delphi does not allow a generic method to be overloaded by a non generic type of the same name (unlike for generic types and non generic routines); this is probably done to simplify the implementation of implicit specializations of generic methods so we do this as well. For this we change the dummy symbol for generic routines from a typesym to a procsym ... Note: what Delphi /does/ allow however is to overload a generic routine with a generic type... go figure. :/ We currently don't allow that"

Reply by email

Pascal Riekenberg
to Michael Van Canneyt: Mine is a little older, so it must be a recent change. I think you better file a…
Show quoted text 23 lines
Michael Van Canneyt hat am 05.01.2021 10:23 geschrieben: On Tue, 5 Jan 2021, Pascal Riekenberg via fpc-devel wrote: >> Michael Van Canneyt via fpc-devel hat am 05.01.2021 09:15 geschrieben: >> >> >> I did a small test, your program compiles with the trunk compiler ? > > No, only if you put StrUtils at the end of the uses list. > >> And I checked, the math IfThen() functions have overload attached. > > Both units have "overload"! > >> What compiler did you use ? > > trunk, r48021 Mine is a little older, so it must be a recent change. I think you better file a bugreport.

I filed a bugreport: https://bugs.freepascal.org/view.php?id=38310

Reply by email