[fpc-pascal] Doubt related to the issue #30498

silvioprog silvioprog at gmail.com
Tue Aug 23 04:23:48 CEST 2016


Hello,

A possible inline way (without declaring specialized local variables) to
compile the attached test at the issue #30498
<http://bugs.freepascal.org/view.php?id=30498> is:

...
  procedure Test(const AItems: TArray<string>);
  begin
  end;

begin
  // Test(['foo', 'bar']); issue #30498
  Test(TArray<string>.Create('foo', 'bar'));
...

However, how to do something like this in the following declaration?:

...
procedure Test(const AItems: TArray<TPair<string, string>>);
...

I've tried:

...
  procedure Test(const AItems: TArray<TPair<string, string>>);
  begin
  end;

begin
  Test(TArray<TPair<string, string>>.Create(TPair<string,
string>.Create('foo', 'bar')));
...

Got:

project1.dpr(18,37) Error: Illegal expression
project1.dpr(18,38) Fatal: Syntax error, ")" expected but "identifier
CREATE" found

Thank you!

--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160822/524bf8b5/attachment.html>


More information about the fpc-pascal mailing list