Handle C++ delete expressions when the overloaded delete operator is a
"usual deallocation function" with two arguments. CodeGen will have to
handle this case specifically, since the value for the second argument
(the size of the allocated object) may have to be computed at run
time.
Fixes the Sema part of PR4782.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83080 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 50af17d..087b464 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -115,3 +115,20 @@
delete x1;
delete x2; // expected-error{{ambiguous conversion of delete expression of type 'struct X2' to a pointer}}
}
+
+// PR4782
+class X3 {
+public:
+ static void operator delete(void * mem, unsigned long size);
+};
+
+class X4 {
+public:
+ static void release(X3 *x);
+ static void operator delete(void * mem, unsigned long size);
+};
+
+
+void X4::release(X3 *x) {
+ delete x;
+}