Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From a05d92ae85024d0648f69f95307a1d3e8e51109c Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 1 Apr 2018 19:55:38 -0700 |
| 4 | Subject: [PATCH] Fix -Werror=class-memaccess |
| 5 | |
| 6 | Casting to void* make gcc happy since its upset about |
| 7 | object types and rightly so |
| 8 | |
| 9 | Fixes |
| 10 | |
| 11 | 'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'struct msgpack::v2::object' from an array of 'const msgpack_object' {aka 'const struct msgpack_object'} [-Werror=class-memaccess] |
| 12 | |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
| 15 | Upstream-Status: Submitted [https://github.com/msgpack/msgpack-c/pull/659] |
| 16 | |
| 17 | include/msgpack/v1/object.hpp | 2 +- |
| 18 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/include/msgpack/v1/object.hpp b/include/msgpack/v1/object.hpp |
| 21 | index 64da8c53..9721f705 100644 |
| 22 | --- a/include/msgpack/v1/object.hpp |
| 23 | +++ b/include/msgpack/v1/object.hpp |
| 24 | @@ -661,7 +661,7 @@ inline object::object(const msgpack_object& o) |
| 25 | inline void operator<< (msgpack::object& o, const msgpack_object& v) |
| 26 | { |
| 27 | // FIXME beter way? |
| 28 | - std::memcpy(&o, &v, sizeof(v)); |
| 29 | + std::memcpy(static_cast<void*>(&o), &v, sizeof(v)); |
| 30 | } |
| 31 | |
| 32 | inline object::operator msgpack_object() const |
| 33 | -- |
| 34 | 2.16.3 |
| 35 | |