From 16fd3ae650607f677ff347e88c502d453cbfd099 Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Tue, 2 Feb 2016 15:09:32 +0100 Subject: [PATCH] Ifdef is_trivially_copyable behind gcc >= 5 guard --- include/engine/object_encoder.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/engine/object_encoder.hpp b/include/engine/object_encoder.hpp index 496e8eadb39..94784de25a7 100644 --- a/include/engine/object_encoder.hpp +++ b/include/engine/object_encoder.hpp @@ -39,7 +39,9 @@ using BinaryFromBase64 = boost::archive::iterators::transform_width< template std::string encodeBase64(const T &x) { - // static_assert(std::is_trivially_copyable::value, "requires a trivially copyable type"); +#if not defined __GNUC__ or __GNUC__ > 4 + static_assert(std::is_trivially_copyable::value, "requires a trivially copyable type"); +#endif std::vector bytes{reinterpret_cast(&x), reinterpret_cast(&x) + sizeof(T)}; @@ -65,7 +67,9 @@ template std::string encodeBase64(const T &x) template T decodeBase64(std::string encoded) { - // static_assert(std::is_trivially_copyable::value, "requires a trivially copyable type"); +#if not defined __GNUC__ or __GNUC__ > 4 + static_assert(std::is_trivially_copyable::value, "requires a trivially copyable type"); +#endif std::replace(begin(encoded), end(encoded), '-', '+'); std::replace(begin(encoded), end(encoded), '_', '/');