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
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 3236d39..d1330e0 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -408,6 +408,8 @@
   llvm::Constant *EmitMemberFunctionPointer(CXXMethodDecl *MD) {
     assert(MD->isInstance() && "Member function must not be static!");
     
+    MD = MD->getCanonicalDecl();
+
     const llvm::Type *PtrDiffTy = 
       CGM.getTypes().ConvertType(CGM.getContext().getPointerDiffType());