diff --git a/include/llvm/Analysis/PtrUseVisitor.h b/include/llvm/Analysis/PtrUseVisitor.h index 6e61fc3be38..2fe7c672526 100644 --- a/include/llvm/Analysis/PtrUseVisitor.h +++ b/include/llvm/Analysis/PtrUseVisitor.h @@ -196,7 +196,10 @@ class PtrUseVisitor : protected InstVisitor, typedef InstVisitor Base; public: - PtrUseVisitor(const DataLayout &DL) : PtrUseVisitorBase(DL) {} + PtrUseVisitor(const DataLayout &DL) : PtrUseVisitorBase(DL) { + static_assert(std::is_base_of::value, + "Must pass the derived type to this template!"); + } /// \brief Recursively visit the uses of the given pointer. /// \returns An info struct about the pointer. See \c PtrInfo for details. diff --git a/include/llvm/IR/InstVisitor.h b/include/llvm/IR/InstVisitor.h index 088d3e0fbfa..55579819fd3 100644 --- a/include/llvm/IR/InstVisitor.h +++ b/include/llvm/IR/InstVisitor.h @@ -116,6 +116,9 @@ public: // visit - Finally, code to visit an instruction... // RetTy visit(Instruction &I) { + static_assert(std::is_base_of::value, + "Must pass the derived type to this template!"); + switch (I.getOpcode()) { default: llvm_unreachable("Unknown instruction type encountered!"); // Build the switch statement using the Instruction.def file...