The assignment to an object of enumeration type with a value that is not of that enumeration type produces an error in C++. In ISO/ANSI C, an object of enumeration type can be assigned values of any integral type.
Enumerations