// Lookup doesn't work for destructors, so handle them separately.
if (isa<CXXDestructorDecl>(this)) {
CXXMethodDecl *MD = RD->getDestructor();
- if (recursivelyOverrides(MD, this))
+ if (MD && recursivelyOverrides(MD, this))
return MD;
return NULL;
}
if (!MostDerivedClassDecl)
return;
CXXMethodDecl *DM = MD->getCorrespondingMethodInClass(MostDerivedClassDecl);
+ if (!DM)
+ return;
SemaRef.MarkAnyDeclReferenced(Loc, DM);
}
b->foo::~foo();
}
}
+
+namespace test3 {
+ // Test that we don't crash in this case.
+ struct B {
+ };
+ struct D : public B {
+ };
+ void f(D d) {
+ // CHECK: define void @_ZN5test31fENS_1DE
+ d.B::~B();
+ }
+}