
{: test that the unpack function causes a fatal error if there is a range error}

{$d+}
program d053( output );

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

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

   c := 'a';
   pa := 'LION';
   unpack( pa, a, side );
   if c <> 'b' then
      writeln( 'unpack for debug has side effects' );

   unpack( pa, a, pred('a') ); { range error }
   writeln( 'fails: unpack range error not detected' );
end. { d053 }

