tb0200.pp 664 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. { Old file: tbs0236.pp }
  2. { Problem with range check of subsets !! compile with -Cr OK 0.99.11 (PFV) }
  3. {$R+}
  4. program test_set_subrange;
  5. uses
  6. erroru;
  7. type
  8. enum = (zero,one,two,three);
  9. sub_enum = one..three;
  10. prec = ^trec;
  11. trec = record
  12. dummy : longint;
  13. en : enum;
  14. next : prec;
  15. end;
  16. const
  17. str : array[sub_enum] of string = ('one','two','three');
  18. procedure test;
  19. var hp : prec;
  20. t : sub_enum;
  21. begin
  22. new(hp);
  23. hp^.en:=zero;
  24. new(hp^.next);
  25. hp^.next^.en:=three;
  26. t:=hp^.en;
  27. Writeln('hp^.en = ',str[hp^.en]);
  28. Writeln('hp^.next^.en = ',str[hp^.next^.en]);
  29. end;
  30. begin
  31. require_error(201);
  32. test;
  33. end.