An enum value is always an integer so the cast is valid. The code here now consider this case to avoid giving an error message.