diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 616f108511..a44bb76e09 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -4179,7 +4179,9 @@ implementation end; in_slice_x: - internalerror(2005101502); + { slice can be used only in calls for open array parameters, so it has to be converted appropriatly before + if we get here, the array could not be passed to an open array parameter so it is an error } + CGMessagePos(left.fileinfo,type_e_mismatch); in_ord_x, in_chr_byte: diff --git a/tests/webtbf/tw39806.pp b/tests/webtbf/tw39806.pp new file mode 100644 index 0000000000..a5067ac44e --- /dev/null +++ b/tests/webtbf/tw39806.pp @@ -0,0 +1,18 @@ +{ %fail } +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)); + // (15,19) Fatal: Internal error 2005101501 +end.