Regression: range check warning
Original Reporter info from Mantis: bork
-
Reporter name: Boris Matkov
Original Reporter info from Mantis: bork
- Reporter name: Boris Matkov
Description:
Regression: range check warning
Steps to reproduce:
try to compile this code:
type
TMySet = (meOne, meTwo, meThree);
function Get1: TMySet;
begin
Result := TMySet(5);
end;
function Get2: TMySet;
var
i: Integer;
begin
i := 5;
Result := TMySet(i);
end;
In FPC 3.0.4 this code will be compiled without warnings. In FPC 3.2.0 I get warning:
Warning: range check error while evaluating constants (5 must be between 0 and 2)
but only in the Get1 function. In the Get2 function compiler do not show warning. In this case this warning does not make sense and behavior in FPC 3.0.4 was correct, when compiler do not show warning in both cases (like in Delphi).
Mantis conversion info:
- Mantis ID: 37342
- Version: 3.2.0
- Monitored by: » @xhajt03 (Tomas Hajny), » denis.totoliciu (Totoliciu Denis Dan)