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

{$d+}
program d083( output );

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

function side : colour;
begin
   side := k;
   k := succ(k);
end;
begin {d083}

   k := indigo;
   writeln( 'succ(indigo) is ', ord(succ(side)) );
   if k <> violet then
      writeln( 'succ for debug has side effects' );

   k := violet;
   writeln( 'succ(k) has value ', ord(succ(k)):1 );
   writeln( 'fails: succ() error is not detected' );
end. { d083 }
