Enumerated types and incompatible type compile errors in Delphi 2007

Posted by Warwick Weston Wright

I was recently writing code using a list of 10 enumerated constants the declaration had the following code Type STTypes=(ST64BitInteger,.....);

and the following line of code caused a compile time error 'incompatible types'
if ST64BitInteger=FrmNewTbl.FrmCreateNewTbl.CmbType.ItemIndex then begin
In this instance I replaced the enumerated declaration with a simple constant definition as follows:

const ST64BitInteger=0
and the program compiled & worked also if I substituted the ST64BitInteger with a literal 0 it also worked.
The question is: are enumerated types in Delphi 2007 treated as constants or is there a bug in the language because my extensive programming experience with many languages has taught me that enumerated types and constants are exactly the same thing as literal values. Or are enumerated types actually designed for a different purpose in Delphi & if so, what is this purpose? Personally I think it's a bug.

Follow Ups