diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp index 9fb6cd3bf265..7bc432296024 100644 --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -70,6 +70,8 @@ #include "llvm/TextAPI/Architecture.h" #include "llvm/TextAPI/InterfaceFile.h" +#include + using namespace llvm; using namespace llvm::MachO; using namespace llvm::support::endian; @@ -358,6 +360,9 @@ void ObjFile::parseSections(ArrayRef sectionHeaders) { template static InputSection *findContainingSubsection(Subsections &subsections, T *offset) { + static_assert(std::is_same::value || + std::is_same::value, + "unexpected type for offset"); auto it = std::prev(llvm::upper_bound( subsections, *offset, [](uint64_t value, Subsection subsec) { return value < subsec.offset; }));