Fix bug #1736

A value to which an enum variable is being compared should be not be valid value in the enum