[fpc-devel] FPC fails on overload

David Jenkins david at scootersoftware.com
Mon Jun 18 22:00:02 CEST 2018


This is something that has just recently stopped working for us(with update
to current trunk).  We previously were using trunk rev 36812 with no
problems.


Placing a second call

foo('a')

calls the expected WideChar version.

David


On 6/18/18 1:11 PM, Marcos Douglas B. Santos wrote:
> 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
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel





More information about the fpc-devel mailing list