Hi,
Here is the variant of Francois' test fsc28.pas:
-----------------------
{$gnu-pascal}
program mir037c;
{slice array write, what Francois has done for Integer here is for Char}
uses GPC;
var v : array['A'..'Z'] of Integer;
i,j : Char;
procedure conformantArray(a: array[l..u : Char] of Integer);
begin
end;
procedure ExpectError;
begin
if ExitCode = 0 then
WriteLn ('failed')
else
begin
WriteLn ('OK');
Halt (0) {!}
end
end;
begin
AtExit(ExpectError);
i:='W'; j:=Succ('Z', 5);
{j out of bounds so slice will be out of bounds too (write)}
conformantArray(v[i..j]); { line 26 }
end.
------------------------
here is what I get:
bash-2.05b$ gpc mir037c.pas
mir037c.pas: In main program:
mir037c.pas:26: invalid operands to binary `+'
mir037c.pas:26: incompatible type for argument 1 of `conformantArray'
mir037c.pas:8: routine declaration
bash-2.05b$
Now, what is done in fsc28.pas looks apparently the same:
---------------------------
{$gnu-pascal}
program fsc28;
{slice array write}
uses GPC;
var v : array[1..100] of Integer;
i,j : Integer;
procedure conformantArray(a: array[l..u : Integer] of Integer);
begin
end;
procedure ExpectError;
begin
if ExitCode = 0 then
WriteLn ('failed')
else
begin
WriteLn ('OK');
Halt (0) {!}
end
end;
begin
AtExit(ExpectError);
i:=99; j:=110;
{j out of bounds so slice will be out of bounds too (write)}
conformantArray(v[i..j]);
end.
-----------------------------
And it passes.
Thanks,
Mirsad
--
"I have a dream!" -- Martin Luther King Jr.