RAD Studio Athens

E2150

Go Up to Error and Warning Messages (Delphi)

You are attempting to construct an array using a type which is not allowed in variable arrays.


program Produce;

  type
    Fruit = (apple, orange, pear);
    Data = record
      xย : Integer;
      chย : Char;
    end;

  var
    fย : Fruit;
    dย : Data;

  procedure Examiner(vย : array of TVarRec);
  begin
  end;

begin
  Examiner([d]);
  Examiner([f]);
end.

Both calls to Examiner will fail because enumerations and records are not supported in array constructors.


program Solve;

  var
    iย : Integer;
    rย : Real;
    vย : Variant;

  procedure Examiner(vย : array of TVarRec);
  begin
  end;

begin
  iย := 0; rย := 0; vย := 0;
  Examiner([i, r, v]);
end.

Many data types, like those in the example above, are allowed in array constructors.