Index: llvm/trunk/include/llvm/ADT/Hashing.h =================================================================== --- llvm/trunk/include/llvm/ADT/Hashing.h +++ llvm/trunk/include/llvm/ADT/Hashing.h @@ -632,7 +632,8 @@ template typename std::enable_if::value, hash_code>::type hash_value(T value) { - return ::llvm::hashing::detail::hash_integer_value(value); + return ::llvm::hashing::detail::hash_integer_value( + static_cast::type>(value)); } // Declared and documented above, but defined here so that any of the hashing Index: llvm/trunk/include/llvm/Support/type_traits.h =================================================================== --- llvm/trunk/include/llvm/Support/type_traits.h +++ llvm/trunk/include/llvm/Support/type_traits.h @@ -54,11 +54,12 @@ }; /// \brief Metafunction that determines whether the given type is either an -/// integral type or an enumeration type. +/// integral type or an enumeration type, including enum classes. /// /// Note that this accepts potentially more integral types than is_integral -/// because it is based on merely being convertible implicitly to an integral -/// type. +/// because it is based on being implicitly convertible to an integral type. +/// Also note that enum classes aren't implicitly convertible to integral types, +/// the value may therefore need to be explicitly converted before being used. template class is_integral_or_enum { typedef typename std::remove_reference::type UnderlyingT; @@ -67,7 +68,8 @@ !std::is_class::value && // Filter conversion operators. !std::is_pointer::value && !std::is_floating_point::value && - std::is_convertible::value; + (std::is_enum::value || + std::is_convertible::value); }; /// \brief If T is a pointer, just return it. If it is not, return T&.