[PATCH] Fix AIX test failure due to replacement operator delete
Jonathan Wakely
jwakely@redhat.com
Mon Jun 17 15:52:00 GMT 2019
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.
-------------- next part --------------
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 --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;
More information about the Gcc-patches
mailing list