fpc/tests/webtbf/tw35671.pp
Jonas Maebe 3a2fe24f49 * report range errors for assigning out-of-range constants to enums in
Delphi mode (mantis #35671)
  * always give an error (rather than only a warning in case range checking
    is disabled) when assigning an out-of-range constant to an ordinal variable
    whose type does not span the entire range that its bits can hold (because
    the result is undefined and FPC's optimisers rely on variables only
    holding values that are valid for the type)

git-svn-id: trunk@42272 -
2019-06-22 17:30:42 +00:00

16 lines
249 B
ObjectPascal

{ %fail }
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.