[fpc-pascal] Pass open array to static array?

Ryan Joseph genericptr at gmail.com
Sun Mar 15 13:06:42 CET 2020


Why doesn't it compile to pass an open array to a static array of the same size? That would nice if this worked since it makes assigning values so easy.

program test;
var
  data: array[0..2] of integer;
begin
  // Incompatible types: got "{Array Of Const/Constant Open} Array of ShortInt" expected "Array[0..2] Of LongInt"
  data := [1,2,3];
end.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list