Using the `in` keyword causes “E1012 Constant expression violates subrange bounds” in Delphi
- 阅读更多 关于 Using the `in` keyword causes “E1012 Constant expression violates subrange bounds” in Delphi
问题 I've come across some rather unusual behaviour in a bit of Delphi code. When using the in keyword to check if an item is in a constant array, I get the following compilation error: E1012 Constant expression violates subrange bounds The constants are defined as follows: type TSomeEnum = (seFoo = 1000, seBar = 2000, seBoo = 3000, seFar = 4000, seFooBar = 5000, seBooFar = 6000, seLow = 1000, seHigh = 6000, seCount = 6); The line that is failing is the following: if someObj.someProperty in [seFoo