fix enum value typecast issue

This is for #13650.