Work around missing std::underlying_type in GCC 4.6

Change-Id: Ic641fe2f1771fe979423c58d285a96399ea16fe2