From 39f901e918c42935d1acf5ad87b79ae1b38a666b Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 17 Jun 2019 16:51:31 +0100 Subject: [PATCH] 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. From-SVN: r272391 --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/testsuite/20_util/allocator/1.cc | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8311111..40d1b0b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2019-06-17 Jonathan Wakely + * testsuite/20_util/allocator/1.cc: Add sized delete, which fixes a + failure on AIX. + * include/c_global/cmath (__lerp, lerp): Add noexcept (LWG 3201). PR libstdc++/90281 Fix string conversions for filesystem::path diff --git a/libstdc++-v3/testsuite/20_util/allocator/1.cc b/libstdc++-v3/testsuite/20_util/allocator/1.cc index 8ea0895..c8a74da 100644 --- a/libstdc++-v3/testsuite/20_util/allocator/1.cc +++ b/libstdc++-v3/testsuite/20_util/allocator/1.cc @@ -24,6 +24,12 @@ #include #include +#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 obj; -- 2.7.4