Hi,

I can pass an array of TVarRec to a procedure that expects an array of const like below:

procedure Test(Args: array of const);
begin
  //do something with args
end;

var
  a: array of TVarRec;
  s: String;

begin
  SetLength(a, 2);
  a[0].VType := vtInteger;
  a[0].VInteger := 3;
  a[1].VType := vtAnsiString;
  s := 'xx';
  a[1].VAnsiString := PAnsiString(s);
  Test(a);
end.


But when i try to do the inverse (pass an array of const to an array of TVarRec) i get the following error:

Error: Incompatible type for arg no. 1: Got "Array Of Const\Constant Open Array of ShortInt", expected "Open Array Of TVarRec"

procedure Test(Args: array of TVarRec);
begin
  //do something with args
end;

begin
  Test([3, 'xx']);
end.


Is that a bug or a limitation of the language?

Using FPC 2.4.4 i386-win32

Luiz


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to