[fpc-devel] FPC fails on overload
Marcos Douglas B. Santos
md at delfire.net
Mon Jun 18 20:11:53 CEST 2018
On Mon, Jun 18, 2018 at 3:04 PM, David Jenkins
<david at scootersoftware.com> wrote:
> The following code:
>
>
> {$MODE DELPHI}
>
> program CharOverload;
>
> uses
> SysUtils;
>
> procedure Foo(const aArg: UnicodeString); overload;
> begin
> WriteLn('WideString: ', aArg);
> end;
>
> procedure Foo(c: WideChar); overload;
> begin
> WriteLn('Char: ', c);
> end;
>
> begin
> Foo('abc');
> end.
>
>
> Fails with current trunk fpc with the following messages
>
>
> [odysseus:fpc-trunk$] compiler/ppc386 ~/Desktop/test/CharOverload.pp
> Free Pascal Compiler version 3.1.1 [2018/06/18] for i386
> Copyright (c) 1993-2018 by Florian Klaempfl and others
> Target OS: Darwin for i386
> Compiling /Users/djenkins/Desktop/test/CharOverload.pp
> CharOverload.pp(19,3) Error: Can't determine which overloaded function to
> call
> CharOverload.pp(19,12) Error: Illegal type conversion: "Constant String" to
> "WideChar"
> CharOverload.pp(20,4) Fatal: There were 2 errors compiling module, stopping
> Fatal: Compilation aborted
>
>
> It fails with same messages with {$MODE OBJFPC}. Is this known. I can enter
> a Mantis if desired.
Hey David,
The compiler says "Can't determine which overloaded function to call"
because both are strings.
Marcos Douglas
More information about the fpc-devel
mailing list