use range assert when loading enum discriminant

Closes #4924
add range assert when loading bools