[fpc-devel] FPC fails on overload

David Jenkins david at scootersoftware.com
Mon Jun 18 20:04:32 CEST 2018


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.


Thanks

David Jenkins






More information about the fpc-devel mailing list