From 7af4ec744e30d573482aef7a37089d0d32cc07ef Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Tue, 5 Jan 2010 05:04:05 +0000 Subject: When emitting member function pointers, use the canonical decl if the member function is virtual. Fixes PR5940. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92680 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprAgg.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExprAgg.cpp') diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index b95fd79901..c852d65b85 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -313,7 +313,8 @@ void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) { "Unexpected member pointer type!"); const DeclRefExpr *DRE = cast(E->getSubExpr()); - const CXXMethodDecl *MD = cast(DRE->getDecl()); + const CXXMethodDecl *MD = + cast(DRE->getDecl())->getCanonicalDecl(); const llvm::Type *PtrDiffTy = CGF.ConvertType(CGF.getContext().getPointerDiffType()); -- cgit v1.2.3