
{: test that a case statement that has no value for its expression causes a fatal error }

{$d+}
program d070( output );

var
   i :  integer;
begin
   i := 32;
   { debug must be on before the end of the statement}
   {$d-} case  {$d+} i+3 of
     0 : writeln( 'shouldn''t be here' );
     1 : writeln( 'shouldn''t be here' );
     2 : writeln( 'shouldn''t be here' );
     3 : writeln( 'shouldn''t be here' );
     4 : writeln( 'shouldn''t be here' );
     5 : writeln( 'shouldn''t be here' );
     6 : writeln( 'shouldn''t be here' );
     7 : writeln( 'shouldn''t be here' );
     8 : writeln( 'shouldn''t be here' );
     9 : writeln( 'shouldn''t be here' );
   end;
   writeln( 'no debug, case without value does not raise error' );

   {$d-}
   i := 32;
   {$d+} case {$d-} i+3 of   { debug enabled }
     0 : writeln( 'shouldn''t be here' );
     1 : writeln( 'shouldn''t be here' );
     2 : writeln( 'shouldn''t be here' );
     3 : writeln( 'shouldn''t be here' );
     4 : writeln( 'shouldn''t be here' );
     5 : writeln( 'shouldn''t be here' );
     6 : writeln( 'shouldn''t be here' );
     7 : writeln( 'shouldn''t be here' );
     8 : writeln( 'shouldn''t be here' );
     9 : writeln( 'shouldn''t be here' );
   end;

   writeln( 'fails: missing case value not detected' );
end. { d070 }

