From c6f08f6c34eff647d12029c9190ce15211b327c2 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 31 Jul 2013 00:32:51 +0200 Subject: [PATCH] fix c++11 union use in remote.cc --- src/remote.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/remote.cc b/src/remote.cc index 6bb26750..e798ee2b 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -132,13 +132,15 @@ void read(int socket, char* buffer, size_t size) template T read(int socket) { - union + union U { T object; - char value[sizeof(T)]; - }; - read(socket, value, sizeof(T)); - return object; + char data[sizeof(T)]; + U() {} + ~U() { object.~T(); } + } u; + read(socket, u.data, sizeof(T)); + return u.object; } template<>