I have declared the following enum type in which I want the first member to have the ordinal value of 1 (one) rather than the usual 0 (zero):
type
TMyEnum = (
meFirstValue = 1,
meSecondValue,
meThirdValue
);
If I call TypeInfo(), e.g. as part of a call to GetEnumName(), I get a compiler error:
GetEnumName(TypeInfo(TMyEnum), Ord(aValue));
ERROR: "E2134: Type 'TMyEnum' has no typeinfo"
Why is this?
I know that classes only have typeinfo if they are compiled with the $M compiler option enabled or (derive from some class which was, such as TPersistent) but I didn't think there were any special conditions for having typeinfo for enum types.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…