generic with constants of sub-range and enumeration data types excluding 0 fail
Original Reporter info from Mantis: kays @KaiBurghardt
-
Reporter name: Kai Burghardt
Original Reporter info from Mantis: kays @KaiBurghardt
- Reporter name: Kai Burghardt
Description:
Zero is assumed for all constant generic parameters while parsing. I’d expect an error upon specialization, but already the generic declaration fails:
Steps to reproduce:
Compilation of
unit foo;
interface
type
measure = (short := 1, long := 2);
generic bar<const x: measure> = object
public
const
myMeasure = ord(x);
end;
implementation
end.
terminates with the error:
…
foo.pas(8,22) Error: Range check error while evaluating constants (0 must be between 1 and 2)
foo.pas(10,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Additional information:
The same applies to myMeasure = 123..456;
Mantis conversion info:
- Mantis ID: 38412
- OS: GNU/Linux
- OS Build: Ubuntu “xenial”
- Build: r47580
- Platform: x86_64
- Version: 3.2.0
- Fixed in version: 3.3.1
- Fixed in revision: 48452 (#4bec5770)