Range checks missing at runtime on type casts using sub ranges
Original Reporter info from Mantis: patrick2901
-
Reporter name: Patrick T.
Original Reporter info from Mantis: patrick2901
- Reporter name: Patrick T.
Description:
First I enabled Range Checks in project settings of Lazarus - this led to ERangeError at compile time when I try to run a method with an out-of-range constant parameter for a sub range type, which is expected behavior so far.
But if I use a type cast with a sub range type, I expected an ERangeError at runtime - but nothing happens - the sub range is not checked on conversion (maybe because of no real type conversion is necessary in this particular case).
Steps to reproduce:
type
TMySubRange = 0..7
var
Test: TMySubRange;
...
Test := TMySubRange(8);
Mantis conversion info:
- Mantis ID: 30423
- OS: Windows
- OS Build: Win10 Home x64
- Build: (Lazarus 1.6 - SVN 51630)
- Platform: x86_64
- Version: 3.0.0