diff mbox series

Fix AIX test failure due to replacement operator delete

Message ID 20190617155212.GA20879@redhat.com
State New
Headers show
Series Fix AIX test failure due to replacement operator delete | expand

Commit Message

Jonathan Wakely June 17, 2019, 3:52 p.m. UTC
On AIX the sized delete defined in the library will call the non-sized
delete defined in the library, not the replacement version defined in
the test file. By also replacing sized delete we make the test pass
everywhere.

	* testsuite/20_util/allocator/1.cc: Add sized delete, which fixes a
	failure on AIX.

This was broken by the recent change to make std::allocator use sized
delete.

Tested x86_64-linux and powerpc-aix, committed to trunk.
commit 8a80c5c7319cd3c2d43457d7a3fbdd9fc2712e03
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Jun 17 15:51:31 2019 +0000

    Fix AIX test failure due to replacement operator delete
    
    On AIX the sized delete defined in the library will call the non-sized
    delete defined in the library, not the replacement version defined in
    the test file. By also replacing sized delete we make the test pass
    everywhere.
    
            * testsuite/20_util/allocator/1.cc: Add sized delete, which fixes a
            failure on AIX.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272391 138bc75d-0d04-0410-961f-82ee72b054a4
diff mbox series

Patch

diff --git a/libstdc++-v3/testsuite/20_util/allocator/1.cc b/libstdc++-v3/testsuite/20_util/allocator/1.cc
index 8ea08958f8d..c8a74dacf63 100644
--- a/libstdc++-v3/testsuite/20_util/allocator/1.cc
+++ b/libstdc++-v3/testsuite/20_util/allocator/1.cc
@@ -24,6 +24,12 @@ 
 #include <cstdlib>
 #include <testsuite_hooks.h>
 
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW throw()
+#endif
+
 struct gnu { };
 
 bool check_new = false;
@@ -36,12 +42,19 @@  operator new(std::size_t n) THROW(std::bad_alloc)
   return std::malloc(n);
 }
 
-void operator delete(void *v) throw()
+void operator delete(void *v) NOTHROW
 {
   check_delete = true;
   return std::free(v);
 }
 
+#if __cpp_sized_deallocation
+void operator delete(void *v, std::size_t) NOTHROW
+{
+  ::operator delete(v);
+}
+#endif
+
 void test01()
 {
   std::allocator<gnu> obj;