X1012 Constant expression violates subrange bounds (Delphi)
Go Up to Error and Warning Messages (Delphi)
This error message occurs when the compiler can determine that a constant is outside the legal range. For example, if you assign a value to an integer variable that is higher than
MaxInt, you trigger this error.
This can occur for instance if you assign a constant to a variable of subrange type.
The following example code triggers this error message:
program Produce; var Digit: 1..9; begin Digit := 0; end.
To fix this issue, you must either include the assigned value in the range:
program Solve; var Digit: 0..9; begin Digit := 0; end.
Alternatively, change the assignment so that the assigned value is within the legal range:
program Solve; var Digit: 1..9; begin Digit := 1; end.