Avoid using the type_info for enumerations, as it is wrong.
Merge pull request #6413 from wmtan/AvoidUsingEnumTypeInfo

Avoid using the type_info for enumerations, as it is wrong.