2
0
mirror of https://github.com/boostorg/uuid.git synced 2026-01-19 04:42:16 +00:00

Silence -Wstrict-aliasing warning in simd_vector.hpp.

This commit is contained in:
Andrey Semashev
2026-01-09 14:24:42 +03:00
parent 39946fb660
commit d53a476a77

View File

@@ -27,12 +27,22 @@ union simd_vector
>
BOOST_FORCEINLINE operator Vector () const noexcept { return get< Vector >(); }
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
#pragma GCC diagnostic push
// dereferencing type-punned pointer will break strict-aliasing rules
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
template< typename Vector >
BOOST_FORCEINLINE typename std::enable_if< sizeof(Vector) <= ByteSize, Vector >::type get() const noexcept
{
using vector_type = typename std::remove_cv< typename std::remove_reference< Vector >::type >::type;
return *reinterpret_cast< const vector_type* >(bytes);
}
#if defined(BOOST_GCC) && (BOOST_GCC >= 40800)
#pragma GCC diagnostic pop
#endif
};
template< typename T >