{: test that pred causes a fatal error if it increments a variable beyong its
   maximum range }

{$d+}
program d084( output );

type
   colour =  (red, orange, yellow, green, blue, indigo, violet);
var
   k : colour;

function side : colour;
begin
   side := k;
   k := pred(k);
end;
begin {d084}

   k := orange;
   writeln( 'pred(orange) is ', ord(pred(side)) );
   if k <> red then
      writeln( 'pred for debug has side effects' );

   k := red;
   writeln( 'pred(red) has value ', ord(pred(k)):1 );
   writeln( 'fails: pred() error is not detected' );
end. { d084 }
