aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-02-08 18:54:05 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-02-08 18:54:05 +0000
commite228ba97c9aff14dcf788773b8af455b9d85f210 (patch)
tree45261db9f6e6026ad87ed660495c9779ad80d5ad
parentb6f3c70fb8a0def24bcaa937dc28358f20859c73 (diff)
Ensure that a operator delete overload is rocognized regardless of cv-quals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95553 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/DeclCXX.cpp3
-rw-r--r--test/SemaCXX/new-delete.cpp8
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 02ad36d479..a519f78fc4 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -587,7 +587,8 @@ bool CXXMethodDecl::isUsualDeallocationFunction() const {
// then this function is a usual deallocation function.
ASTContext &Context = getASTContext();
if (getNumParams() != 2 ||
- !Context.hasSameType(getParamDecl(1)->getType(), Context.getSizeType()))
+ !Context.hasSameUnqualifiedType(getParamDecl(1)->getType(),
+ Context.getSizeType()))
return false;
// This function is a usual deallocation function if there are no
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 6f89555343..acd4a23cb3 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -217,6 +217,14 @@ static void* f(void* g)
return new (g) X13();
}
+class X14 {
+ static void operator delete(void*, const size_t);
+};
+
+void f(X14 *x14a, X14 *x14b) {
+ delete x14a;
+}
+
namespace PR5918 { // Look for template operator new overloads.
struct S { template<typename T> static void* operator new(size_t, T); };
void test() {