diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp --- 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 @@ 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; }));