Fix gcc warning of different enum and non-enum types in ternary