[fpc-pascal] Error? No range checks in mode delphi?

Anthony Walter sysrpl at gmail.com
Mon Jun 3 21:45:15 CEST 2019


Is the following a bug in the compiler or a feature? Is would seem using
{$mode delphi} allows code which clearly violates range bound to compile
without error.

program Project1;

{$mode delphi}

type
  TSuit = (suHeart, suDiamond, suClub, suSpade);
  TRedSuit = suHeart..suDiamond;

var
  Suit: TRedSuit;
begin
  // This should generate an error, but {$mode delphi} allows it
  Suit := suClub;
end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190603/0a9ee7a8/attachment.html>


More information about the fpc-pascal mailing list