Sign in Join

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

Mailing lists / fpc-devel / 2023-07

Error: (3069) Call by var for arg no. xx has to match exactly: Got "ShortString" expected "AnsiString"

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Michael Van Canneyt
to Maxim Ganetsky
Maxim Ganetsky wrote 15 lines
Hello. Recent changes in FPC `main` led to the following errors when building some code in Lazarus tree: Error: (3069) Call by var for arg no. xx has to match exactly: Got "ShortString" expected "AnsiString" See: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40381 Note that the unit which fails to build has {$H-} directive. Is it a bug in compiler?

No. We're preparing for the unicode RTL.

Part of that was changing string -> shortstring and pchar -> ansichar.

In some rare places I changed string to ansistring in preparation of unicodestring, in this case it was misplaced since it was a var argument. I added an overloaded version, which should fix the compilation error.

Michael.

Reply by email

Maxim Ganetsky
to Michael Van Canneyt

16.07.2023 20:08, Michael Van Canneyt via fpc-devel пишет:

Show quoted text 28 lines
On Sun, 16 Jul 2023, Maxim Ganetsky via fpc-devel wrote: > Hello. > > Recent changes in FPC `main` led to the following errors when > building some code in Lazarus tree: > > Error: (3069) Call by var for arg no. xx has to match exactly: Got > "ShortString" expected "AnsiString" > > See: > > https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40381 > > Note that the unit which fails to build has {$H-} directive. > > Is it a bug in compiler? No. We're preparing for the unicode RTL. Part of that was changing string -> shortstring and pchar -> ansichar. In some rare places I changed string to ansistring in preparation of unicodestring, in this case it was misplaced since it was a var argument. I added an overloaded version, which should fix the compilation error.

But I thought that it was possible to assign ShortString to AnsiString. Am I mistaken?

Best regards, Maxim Ganetsky

Reply by email

Maxim Ganetsky
to Maxim Ganetsky

16.07.2023 20:14, Maxim Ganetsky via fpc-devel пишет:

Show quoted text 32 lines
16.07.2023 20:08, Michael Van Canneyt via fpc-devel пишет: > > > On Sun, 16 Jul 2023, Maxim Ganetsky via fpc-devel wrote: > >> Hello. >> >> Recent changes in FPC `main` led to the following errors when >> building some code in Lazarus tree: >> >> Error: (3069) Call by var for arg no. xx has to match exactly: Got >> "ShortString" expected "AnsiString" >> >> See: >> >> https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40381 >> >> Note that the unit which fails to build has {$H-} directive. >> >> Is it a bug in compiler? > > No. We're preparing for the unicode RTL. > > Part of that was changing string -> shortstring and pchar -> ansichar. > > In some rare places I changed string to ansistring in preparation of > unicodestring, in this case it was misplaced since it was a var > argument. I added an overloaded version, which should fix the > compilation error. But I thought that it was possible to assign ShortString to AnsiString. Am I mistaken?

Ah, I see now that it is Var argument, so they should match exactly.

Thanks for helping.

Best regards, Maxim Ganetsky

Reply by email

Michael Van Canneyt
to Maxim Ganetsky: 16.07.2023 20:08, Michael Van Canneyt via fpc-devel пишет: But I thought that it was…
Maxim Ganetsky wrote 32 lines
16.07.2023 20:08, Michael Van Canneyt via fpc-devel пишет: > > > On Sun, 16 Jul 2023, Maxim Ganetsky via fpc-devel wrote: > >> Hello. >> >> Recent changes in FPC `main` led to the following errors when >> building some code in Lazarus tree: >> >> Error: (3069) Call by var for arg no. xx has to match exactly: Got >> "ShortString" expected "AnsiString" >> >> See: >> >> https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40381 >> >> Note that the unit which fails to build has {$H-} directive. >> >> Is it a bug in compiler? > > No. We're preparing for the unicode RTL. > > Part of that was changing string -> shortstring and pchar -> ansichar. > > In some rare places I changed string to ansistring in preparation of > unicodestring, in this case it was misplaced since it was a var > argument. I added an overloaded version, which should fix the > compilation error. But I thought that it was possible to assign ShortString to AnsiString. Am I mistaken?

It is, but not for a var argument. As it says in the error message "Call by var for arg no. xx has to match exactly"

Anyway, please try the fix with the latest fpc.

Michael.

Reply by email