[fpc-devel] Implicit cast from Char/String to array of Char
Ondrej Pokorny
lazarus at kluug.net
Mon Feb 25 08:09:03 CET 2019
Hello!
Implicit cast from Char/String to array of Char: is this a wanted
behavior or is it a compiler bug?
(Btw. MODE DELPHI behaves the same).
program Project1;
{$mode objfpc}{$H+}
procedure A(AC: array of Char);
var
C: Char;
begin
for C in AC do
WriteLn(C);
end;
procedure B(AC: array of Integer);
var
C: Integer;
begin
for C in AC do
WriteLn(C);
end;
begin
A('a'); // no error in FPC (error in Delphi)
A('ab'); // no error in FPC (error in Delphi)
B(1); // error in FPC & Delphi
end.
Ondrej
More information about the fpc-devel
mailing list