From f0b0dacf27f249a96c3aae1c121885a84f06b060 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Fri, 5 Sep 2025 15:59:33 +1000 Subject: [PATCH] __cpp_sized_deallocation is not always defined (clang is opt-in) for Issue #306 --- include/boost/container/new_allocator.hpp | 2 +- test/allocator_argument_tester.hpp | 2 +- test/dummy_test_allocator.hpp | 4 ++-- test/explicit_inst_vector_test.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/container/new_allocator.hpp b/include/boost/container/new_allocator.hpp index 1dadb2b..009fce0 100644 --- a/include/boost/container/new_allocator.hpp +++ b/include/boost/container/new_allocator.hpp @@ -163,7 +163,7 @@ class new_allocator void deallocate(pointer ptr, size_type n) BOOST_NOEXCEPT_OR_NOTHROW { (void)n; - # if __cpp_sized_deallocation + # if defined(__cpp_sized_deallocation) ::operator delete((void*)ptr, n * sizeof(T)); #else ::operator delete((void*)ptr); diff --git a/test/allocator_argument_tester.hpp b/test/allocator_argument_tester.hpp index 584d2b7..909204f 100644 --- a/test/allocator_argument_tester.hpp +++ b/test/allocator_argument_tester.hpp @@ -74,7 +74,7 @@ class propagation_test_allocator void deallocate(value_type *ptr, std::size_t n) { (void)n; - # if __cpp_sized_deallocation + # if defined(__cpp_sized_deallocation) ::operator delete((void*)ptr, n * sizeof(value_type)); #else ::operator delete((void*)ptr); diff --git a/test/dummy_test_allocator.hpp b/test/dummy_test_allocator.hpp index 8688647..986c771 100644 --- a/test/dummy_test_allocator.hpp +++ b/test/dummy_test_allocator.hpp @@ -65,7 +65,7 @@ class simple_allocator void deallocate(T *ptr, std::size_t n) BOOST_NOEXCEPT_OR_NOTHROW { (void)n; - # if __cpp_sized_deallocation + # if defined(__cpp_sized_deallocation) ::operator delete((void*)ptr, n * sizeof(T)); #else ::operator delete((void*)ptr); @@ -187,7 +187,7 @@ class propagation_test_allocator void deallocate(T *ptr, std::size_t n) BOOST_NOEXCEPT_OR_NOTHROW { (void)n; - # if __cpp_sized_deallocation + # if defined(__cpp_sized_deallocation) ::operator delete((void*)ptr, n * sizeof(T)); #else ::operator delete((void*)ptr); diff --git a/test/explicit_inst_vector_test.cpp b/test/explicit_inst_vector_test.cpp index fadb651..415761b 100644 --- a/test/explicit_inst_vector_test.cpp +++ b/test/explicit_inst_vector_test.cpp @@ -38,7 +38,7 @@ class CustomAllocator void deallocate(pointer ptr, size_type n) { (void)n; - # if __cpp_sized_deallocation + # if defined(__cpp_sized_deallocation) ::operator delete((void*)ptr, n * sizeof(value_type)); #else ::operator delete((void*)ptr);