[cfe-commits] r95553 - in /cfe/trunk: lib/AST/DeclCXX.cpp test/SemaCXX/new-delete.cpp

Chandler Carruth chandlerc at gmail.com
Mon Feb 8 10:54:05 PST 2010


Author: chandlerc
Date: Mon Feb  8 12:54:05 2010
New Revision: 95553

URL: http://llvm.org/viewvc/llvm-project?rev=95553&view=rev
Log:
Ensure that a operator delete overload is rocognized regardless of cv-quals.

Modified:
    cfe/trunk/lib/AST/DeclCXX.cpp
    cfe/trunk/test/SemaCXX/new-delete.cpp

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=95553&r1=95552&r2=95553&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Mon Feb  8 12:54:05 2010
@@ -587,7 +587,8 @@
   //   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 

Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=95553&r1=95552&r2=95553&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Mon Feb  8 12:54:05 2010
@@ -217,6 +217,14 @@
     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() {





More information about the cfe-commits mailing list