{: test pred range error causes a fatal error }

{d+}
program d1015( output );

type
   colour = ( black, brown, red, orange, yellow, green, blue, violet, grey, white);
var
   k : integer;
   c : colour;

function side: integer;
begin
   side := k;
   k := k+1;
end;
begin {d1015}

   k := 4;
   if pred( green, side ) <> brown then
      writeln( 'pred error 1' );
   if k <> 5 then
      writeln( 'pred error 2' );
   k := 5;
   if pred( red, -side ) <> violet then
      writeln( 'pred error 3' );
   if k <> 6 then
      writeln( 'pred error 4' );
   if pred(brown, 0) <> brown then
      writeln( 'pred error 5' );

   if (ord(pred( black, 1 )) = 0) or true then
      writeln( 'fails: pred range error is not detected' );
end. { d1015 }

