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

{$d+}
program d052( 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 {d052}

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

   c := 'x';
   unpack( pa, a, c ); { range error }
   writeln( 'fails: unpack range error not detected' );
end. { d052 }

