diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 1dd97d6a228b..82ec4fd0b7be 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -298,7 +298,7 @@ void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) { llvm::Value *FuncPtr; if (MD->isVirtual()) { - uint64_t Index = CGF.CGM.GetVtableIndex(MD); + uint64_t Index = CGF.CGM.GetVtableIndex(MD->getCanonicalDecl()); FuncPtr = llvm::ConstantInt::get(PtrDiffTy, Index + 1); } else { diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index a742355f74d5..0fd765235c96 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -413,7 +413,7 @@ public: // Get the function pointer (or index if this is a virtual function). if (MD->isVirtual()) { - uint64_t Index = CGM.GetVtableIndex(MD); + uint64_t Index = CGM.GetVtableIndex(MD->getCanonicalDecl()); Values[0] = llvm::ConstantInt::get(PtrDiffTy, Index + 1); } else {