From 5a3eaf88acbad04194e7e5fad6fe6ba9b3a20748 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Wed, 18 Dec 2019 16:37:26 +0100 Subject: Workaround class-memaccess warnings on newer GCC versions --- test/packetmath.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/packetmath.cpp b/test/packetmath.cpp index 5e4d6f0d3..9564bc283 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -43,7 +43,8 @@ T apply_bit_op(Bits a, Bits b, Func f) { T res; for(Index i = 0; i < data.size(); ++i) data[i] = f(a[i], b[i]); - std::memcpy(&res, &data, sizeof(T)); + // Note: The reinterpret_cast works around GCC's class-memaccess warnings: + std::memcpy(reinterpret_cast(&res), &data, sizeof(T)); return res; } -- cgit v1.2.3