Comparing variable with out of range value yields false without typecast
Original Reporter info from Mantis: blimey
-
Reporter name: Geoffrey A Swift
Original Reporter info from Mantis: blimey
- Reporter name: Geoffrey A Swift
Description:
FPC and Delphi yield inconsistent results for the example program.
program fail;
{$APPTYPE CONSOLE}
type
TTest = 1..1;
var
Test: TTest;
begin
Test := TTest(0);
writeln(0 = Test);
writeln(0 = Integer(Test));
end.
Steps to reproduce:
Compile and execute the example source code.
An FPC build yields:
FALSE
TRUE
Using Delphi yields:
TRUE
TRUE
Additional information:
For the test which yields 'FALSE' on FPC, I would expect the variable "Test" to be implicitly converted to an Integer.
Mantis conversion info:
- Mantis ID: 24421
- Version: 2.6.2