"Unexpected member pointer type!");
const DeclRefExpr *DRE = cast<DeclRefExpr>(E->getSubExpr());
- const CXXMethodDecl *MD = cast<CXXMethodDecl>(DRE->getDecl());
+ const CXXMethodDecl *MD =
+ cast<CXXMethodDecl>(DRE->getDecl())->getCanonicalDecl();
const llvm::Type *PtrDiffTy =
CGF.ConvertType(CGF.getContext().getPointerDiffType());
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());
}
}
+// PR5940
+namespace PR5940 {
+ class foo {
+ public:
+ virtual void baz(void);
+ };
+
+ void foo::baz(void) {
+ void (foo::*ptr)(void) = &foo::baz;
+ }
+}