Skip to content

Internal error 2005101502 when Slice is used in the wrong place

Summary

Using Slice() in place of a dynamic array parameter (instead of an open array parameter) raises internal error 2005101502.

The documentation explains why this doesn't work:

It returns an array with the same element type as A, but this array is not assignment compatible to any other array, and can therefor only be used in open array arguments to functions.

Makes sense, it is indeed a programmer error, but the error message doesn't tell me that.

System Information

  • Operating system: Windows
  • Processor architecture: x86
  • Compiler version: trunk

Example Project

program test;

type
  TByteDynArr = array of byte;

procedure proc(a: TByteDynArr);
begin
  Writeln(Length(a));
end;

var
  x: array of byte;
begin
  x:= [1,2,3,4];
  proc(Slice(x, 2));
  // <source>(15,19) Fatal: Internal error 2005101501
end.

What is the current bug behavior?

Compiler dies with Internal Error 2005101502

What is the expected (correct) behavior?

Proper error message that reflects why this doesn't work.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information