Fix a crash on template delete operators.
llvm-svn: 110542
This commit is contained in:
parent
7f36ac54d7
commit
9b41823177
|
@ -1301,8 +1301,14 @@ bool Sema::FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
|
|||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -332,3 +332,15 @@ namespace PR7810 {
|
|||
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*);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue