]> gcc.gnu.org Git - gcc.git/commitdiff
Core issue 901
authorJason Merrill <jason@redhat.com>
Sat, 25 Jul 2009 03:57:20 +0000 (23:57 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 25 Jul 2009 03:57:20 +0000 (23:57 -0400)
Core issue 901
* libsupc++/vec.cc (__cxa_vec_new2, __cxa_vec_new3): Handle NULL
dealloc.
* call.c (build_op_delete_call): If this is for a new-expression
and the op delete is deleted, do nothing.

From-SVN: r150073

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/defaulted11.C [new file with mode: 0644]
libstdc++-v3/ChangeLog
libstdc++-v3/libsupc++/vec.cc

index 6bb4a57561b17e752fe2e432465bdee63c3c66a0..2ee951c907ddad10144bbf0ecb1b993510e6175c 100644 (file)
@@ -1,5 +1,9 @@
 2009-07-24  Jason Merrill  <jason@redhat.com>
 
+       Core issue 901
+       * call.c (build_op_delete_call): If this is for a new-expression
+       and the op delete is deleted, do nothing.
+
        Core issue 702
        * call.c (compare_ics): Give list-initialization of std::init_list
        priority over conversion to scalar, too.
index d396aff12fd48b18f8e40ab6f2dcefd5555e4c4d..0254ecb8af9be6a0fbb460b13b6912abdc1db966 100644 (file)
@@ -4595,6 +4595,10 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
       if (DECL_CLASS_SCOPE_P (fn))
        perform_or_defer_access_check (TYPE_BINFO (type), fn, fn);
 
+      /* Core issue 901: It's ok to new a type with deleted delete.  */
+      if (DECL_DELETED_FN (fn) && alloc_fn)
+       return NULL_TREE;
+
       if (placement)
        {
          /* The placement args might not be suitable for overload
index ea7a034092c01404f050454c053eeef21ec26984..00dbba780f65136bc86b781f1e2ac8f2e0ff6fba 100644 (file)
@@ -1,5 +1,7 @@
 2009-07-24  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/cpp0x/defaulted11.C: New.
+
        * g++.dg/cpp0x/initlist23.C: New.
 
 2009-07-24  Janus Weil  <janus@gcc.gnu.org>
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted11.C b/gcc/testsuite/g++.dg/cpp0x/defaulted11.C
new file mode 100644 (file)
index 0000000..b9bed7e
--- /dev/null
@@ -0,0 +1,15 @@
+// Core issue 901
+// { dg-options "-std=c++0x" }
+
+struct A
+{
+  A(); ~A();
+  void operator delete (void *) = delete;
+  void operator delete[] (void *) = delete;
+};
+
+int main()
+{
+  A* ap = new A;
+  ap = new A[2];
+}
index a89a4a6830ab2eb4a781d564c18bb8728d0cf344..21f67c5d670f8f566c1d06aaa5dd26033920f108 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-24  Jason Merrill  <jason@redhat.com>
+
+       Core issue 901
+       * libsupc++/vec.cc (__cxa_vec_new2, __cxa_vec_new3): Handle NULL
+       dealloc.
+
 2009-07-24  Joseph Myers  <joseph@codesourcery.com>
 
        * include/c_global/cwchar (swprintf, vswprintf): Do not use if
index f1322896d0be55b44b8c9c2b9667799c1f48e0d9..e44a023049ed52ae94508fdfaa605550f183877f 100644 (file)
@@ -104,7 +104,10 @@ namespace __cxxabiv1
       {
        {
          uncatch_exception ue;
-         dealloc(base - padding_size);
+         // Core issue 901 will probably be resolved such that a
+         // deleted operator delete means not freeing memory here.
+         if (dealloc)
+           dealloc(base - padding_size);
        }
        __throw_exception_again;
       }
@@ -142,7 +145,8 @@ namespace __cxxabiv1
       {
        {
          uncatch_exception ue;
-         dealloc(base - padding_size, size);
+         if (dealloc)
+           dealloc(base - padding_size, size);
        }
        __throw_exception_again;
       }
This page took 0.1144 seconds and 5 git commands to generate.