* dont' allow assignments to array of const, resolves #41230

This commit is contained in:
florian 2025-04-09 22:35:55 +02:00
parent 2d6a0d59f0
commit 4cae231a52
2 changed files with 12 additions and 1 deletions

View File

@ -746,7 +746,7 @@ implementation
maybe_call_procvar(right,true);
{ assignments to formaldefs and open arrays aren't allowed }
if is_open_array(left.resultdef) then
if is_open_array(left.resultdef) or is_array_of_const(left.resultdef) then
begin
CGMessage(type_e_assignment_not_allowed);
result:=cerrornode.create;

11
tests/webtbf/tw41230.pp Normal file
View File

@ -0,0 +1,11 @@
{ %fail }
program app;
{$mode objfpc}
procedure test(a: array of const);
begin
a := [1, 2, 3];
end;
begin
end.