Fix compilation on clang in C++03 mode.

Emulated scoped enums should be casted using boost::underlying_cast instead of C-style casts or static_casts.