cast not needed.  Not sure what it would have done before though - could have potentially corrupted memory.  There is some similar code in other places - if the enum type used a smaller enum type (e.g., --short-enums) it would cause problems.