From 1ef175aa91ff0d4e58ae94f257aa51926ed748c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 2 Nov 2025 23:01:14 +0100 Subject: [PATCH] Fix -Wcast-qual warnings. --- include/boost/container/allocator_traits.hpp | 4 ++-- include/boost/container/string.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/container/allocator_traits.hpp b/include/boost/container/allocator_traits.hpp index 6bd6297..712ab29 100644 --- a/include/boost/container/allocator_traits.hpp +++ b/include/boost/container/allocator_traits.hpp @@ -91,7 +91,7 @@ namespace dtl { template BOOST_CONTAINER_FORCEINLINE void construct_type(T *p, BOOST_FWD_REF(Args) ...args) { - ::new((void*)p, boost_container_new_t()) T(::boost::forward(args)...); + ::new(const_cast(static_cast(p)), boost_container_new_t()) T(::boost::forward(args)...); } #else @@ -102,7 +102,7 @@ BOOST_CONTAINER_FORCEINLINE \ typename dtl::disable_if_c::value, void >::type \ construct_type(T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - ::new((void*)p, boost_container_new_t()) T( BOOST_MOVE_FWD##N );\ + ::new(const_cast(static_cast(p)), boost_container_new_t()) T( BOOST_MOVE_FWD##N );\ }\ // BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ) diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index 4777641..363dbfb 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -274,7 +274,7 @@ class basic_string_base //active representation is short or long short_header hdr; BOOST_CONTAINER_STATIC_ASSERT((sizeof(short_header) == 1)); - *(unsigned char*)&hdr = *(unsigned char*)&this->members_.m_repr; + *(unsigned char*)&hdr = *static_cast(static_cast(&this->members_.m_repr)); return hdr.is_short != 0; }