summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/DeclCXX.cpp3
-rw-r--r--clang/test/SemaCXX/new-delete.cpp8
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 02ad36d4790..a519f78fc45 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/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/clang/test/SemaCXX/new-delete.cpp b/clang/test/SemaCXX/new-delete.cpp
index 6f895553431..acd4a23cb35 100644
--- a/clang/test/SemaCXX/new-delete.cpp
+++ b/clang/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() {
OpenPOWER on IntegriCloud