diff --git a/llvm/include/llvm/Support/BinaryStreamWriter.h b/llvm/include/llvm/Support/BinaryStreamWriter.h index dddf53bd5483c..39ce0b6e4c110 100644 --- a/llvm/include/llvm/Support/BinaryStreamWriter.h +++ b/llvm/include/llvm/Support/BinaryStreamWriter.h @@ -10,6 +10,7 @@ #define LLVM_SUPPORT_BINARYSTREAMWRITER_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLForwardCompat.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/BinaryStreamArray.h" #include "llvm/Support/BinaryStreamError.h" @@ -69,8 +70,7 @@ class BinaryStreamWriter { static_assert(std::is_enum::value, "Cannot call writeEnum with non-Enum type"); - using U = std::underlying_type_t; - return writeInteger(static_cast(Num)); + return writeInteger(llvm::to_underlying(Num)); } /// Write the unsigned integer Value to the underlying stream using ULEB128