diff --git a/llvm/include/llvm/ADT/Sequence.h b/llvm/include/llvm/ADT/Sequence.h index ce969ef280b39..ae446df345ee0 100644 --- a/llvm/include/llvm/ADT/Sequence.h +++ b/llvm/include/llvm/ADT/Sequence.h @@ -86,6 +86,7 @@ #include // std::is_integral, std::is_enum, std::underlying_type, // std::enable_if +#include "llvm/ADT/STLForwardCompat.h" // llvm::to_underlying #include "llvm/Support/MathExtras.h" // AddOverflow / SubOverflow namespace llvm { @@ -139,8 +140,7 @@ struct CheckedInt { template ::value, bool> = 0> static CheckedInt from(Enum FromValue) { - using type = std::underlying_type_t; - return from(static_cast(FromValue)); + return from(llvm::to_underlying(FromValue)); } // Equality