diff --git a/include/boost/uuid/uuid.hpp b/include/boost/uuid/uuid.hpp index 3e94ba0..42d63ad 100644 --- a/include/boost/uuid/uuid.hpp +++ b/include/boost/uuid/uuid.hpp @@ -45,7 +45,20 @@ private: { private: - std::uint8_t repr_[ 16 ] = {}; + union + { + std::uint8_t repr_[ 16 ]; + +#if !defined(BOOST_UUID_DISABLE_ALIGNMENT) + + std::uint64_t align_u64_; + +# if defined(__SIZEOF_INT128__) + __uint128_t align_u128_; +# endif + +#endif + }; public: @@ -70,7 +83,7 @@ public: // data - data_type data; + data_type data = {}; public: diff --git a/test/test_alignment.cpp b/test/test_alignment.cpp index 4a8a583..f939282 100644 --- a/test/test_alignment.cpp +++ b/test/test_alignment.cpp @@ -2,6 +2,8 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#define BOOST_UUID_DISABLE_ALIGNMENT + #include #include #include