llvm::SmallVector<DeclAccessPair,4> Matches;
for (LookupResult::iterator F = Found.begin(), FEnd = Found.end();
F != FEnd; ++F) {
- CXXMethodDecl *Delete = cast<CXXMethodDecl>((*F)->getUnderlyingDecl());
- if (Delete->isUsualDeallocationFunction())
+ NamedDecl *ND = (*F)->getUnderlyingDecl();
+
+ // Ignore template operator delete members from the check for a usual
+ // deallocation function.
+ if (isa<FunctionTemplateDecl>(ND))
+ continue;
+
+ if (cast<CXXMethodDecl>(ND)->isUsualDeallocationFunction())
Matches.push_back(F.getPair());
}
static void operator delete(void *volatile);
};
}
+
+// Don't crash on template delete operators
+namespace TemplateDestructors {
+ struct S {
+ virtual ~S() {}
+
+ void* operator new(const size_t size);
+ template<class T> void* operator new(const size_t, const int, T*);
+ void operator delete(void*, const size_t);
+ template<class T> void operator delete(void*, const size_t, const int, T*);
+ };
+}