
{: test that the pack function causes a fatal error if
   there is a range error with a conformant array parameter }

{$d+}
program d106( output );

type lowCase =  'a'..'z';
var
   a  : array['a'..'z'] of lowCase;
   pa : packed array[1..4] of char;
   c  : char;

function side : char;
begin
   side := c;
   c := succ(c);
end;

procedure p( a : array[c0..c1 : char] of lowCase;
            pa : packed array[i0..i1 :integer ] of char
            );
begin
   c := 'w';
   pack( a, side, pa );
   if c <> 'x' then
      writeln( 'pack for debug has side effects' );

   pack( a, 'x', pa ); { range error }
   writeln( 'fails: pack range error not detected' );
end; { p }

begin {d106}
   p(a, pa);
end. { d106 }

