mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 10:50:14 +02:00
* do not throw an internal error if slice is used on dyn. array paramters, resolves #39806
This commit is contained in:
parent
2d8b10a5d8
commit
8eb2cea349
@ -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:
|
||||
|
18
tests/webtbf/tw39806.pp
Normal file
18
tests/webtbf/tw39806.pp
Normal file
@ -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));
|
||||
// <source>(15,19) Fatal: Internal error 2005101501
|
||||
end.
|
Loading…
Reference in New Issue
Block a user