diff --git a/doc/changes.qbk b/doc/changes.qbk index aadeb97..f7ab411 100644 --- a/doc/changes.qbk +++ b/doc/changes.qbk @@ -174,4 +174,9 @@ * Ongoing work on improving `hash_combine`. This changes the combine function which was previously defined in the reference documentation. +[h2 Boost 1.58.0] + +* Fixed strict aliasing violation + ([@https://github.com/boostorg/functional/pull/3 GitHub #3]). + [endsect] diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp index ee0ee87..eb9264f 100644 --- a/include/boost/functional/hash/detail/hash_float.hpp +++ b/include/boost/functional/hash/detail/hash_float.hpp @@ -68,7 +68,7 @@ namespace boost std::size_t seed = 0; if (length >= sizeof(std::size_t)) { - seed = *(std::size_t*) ptr; + std::memcpy(&seed, ptr, sizeof(std::size_t)); length -= sizeof(std::size_t); ptr += sizeof(std::size_t);