[cfe-commits] r110542 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/new-delete.cpp
Chandler Carruth
chandlerc at gmail.com
Sun Aug 8 00:04:00 PDT 2010
Author: chandlerc
Date: Sun Aug 8 02:04:00 2010
New Revision: 110542
URL: http://llvm.org/viewvc/llvm-project?rev=110542&view=rev
Log:
Fix a crash on template delete operators.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/new-delete.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=110542&r1=110541&r2=110542&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sun Aug 8 02:04:00 2010
@@ -1301,8 +1301,14 @@
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());
}
Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=110542&r1=110541&r2=110542&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Sun Aug 8 02:04:00 2010
@@ -332,3 +332,15 @@
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*);
+ };
+}
More information about the cfe-commits
mailing list