From 0219333fa1144cf811ae2324b64eb266f002f343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 30 May 2024 23:07:57 +0200 Subject: [PATCH] Disable strict aliasing for C++03 implementations as type-punning is used to make value_type movable. --- include/boost/container/flat_map.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index e4843f5..09a2c25 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -52,6 +52,12 @@ #define BOOST_CONTAINER_STD_PAIR_IS_MOVABLE #endif +//for C++03 compilers, were type-puning is the only option for std::pair +//disable strict aliasing to reduce problems. +#if defined(BOOST_GCC) && (BOOST_GCC >= 100000) && !defined(BOOST_CONTAINER_STD_PAIR_IS_MOVABLE) +#pragma GCC push_options +#pragma GCC optimize("no-strict-aliasing") +#endif namespace boost { namespace container { @@ -3014,6 +3020,10 @@ class flat_multimap { x.swap(y); } }; +#if defined(BOOST_GCC) && (BOOST_GCC >= 100000) && !defined(BOOST_CONTAINER_STD_PAIR_IS_MOVABLE) +#pragma GCC pop_options +#endif + #ifndef BOOST_CONTAINER_NO_CXX17_CTAD template