From a296628ce329a09c86a4e1bcdc306134f445568b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 30 Jan 2018 14:18:45 +0100 Subject: [PATCH] Add member "data" char array to aligned_storage::type so that placement new does not break strict alignment --- include/boost/move/detail/type_traits.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/boost/move/detail/type_traits.hpp b/include/boost/move/detail/type_traits.hpp index 272cb11..a3326d0 100644 --- a/include/boost/move/detail/type_traits.hpp +++ b/include/boost/move/detail/type_traits.hpp @@ -973,7 +973,7 @@ struct aligned_struct; template\ struct BOOST_ALIGNMENT(A) aligned_struct\ {\ - char dummy[Len];\ + char data[Len];\ };\ // @@ -997,9 +997,10 @@ BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x1000) // Workaround for bogus [-Wignored-attributes] warning on GCC 6.x/7.x: don't use a type that "directly" carries the alignment attribute. // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82270 template -struct aligned_struct_wrapper +union aligned_struct_wrapper { - aligned_struct dummy; + aligned_struct aligner; + char data[sizeof(aligned_struct)]; }; template @@ -1014,7 +1015,7 @@ template union aligned_union { T aligner; - char dummy[Len]; + char data[Len]; }; template