From f541d1ac4d74d7fa2af4534d8d4fa4e8addd103b Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 18 Feb 2022 21:21:59 +0200 Subject: [PATCH] Return the address of the char[] array from aligned_storage::address --- include/boost/type_traits/aligned_storage.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/boost/type_traits/aligned_storage.hpp b/include/boost/type_traits/aligned_storage.hpp index 8ad00a2..d8e26aa 100644 --- a/include/boost/type_traits/aligned_storage.hpp +++ b/include/boost/type_traits/aligned_storage.hpp @@ -42,21 +42,20 @@ struct aligned_storage_imp { union data_t { - char buf[size_]; - + unsigned char buf[size_]; typename ::boost::type_with_alignment::type align_; } data_; - void* address() const { return const_cast(this); } + void* address() const { return const_cast(data_.buf); } }; template struct aligned_storage_imp { union data_t { - char buf[size]; + unsigned char buf[size]; ::boost::detail::max_align align_; } data_; - void* address() const { return const_cast(this); } + void* address() const { return const_cast(data_.buf); } }; template< std::size_t alignment_ >