From cc66618e7051a9f8b9259022d6495f189098db82 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Thu, 4 May 2017 21:58:28 +0200 Subject: [PATCH] Fixed error `forming reference to reference` (issue #495) --- CHANGELOG.md | 1 + src/ArduinoJson/Data/ValueSetter.hpp | 22 ++++++++++------------ test/CMakeLists.txt | 6 ++++++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f501c149..ba1ede28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ HEAD ---- * Fixed error `IsBaseOf is not a member of ArduinoJson::TypeTraits` (issue #495) +* Fixed error `forming reference to reference` (issue #495) v5.9.0 ------ diff --git a/src/ArduinoJson/Data/ValueSetter.hpp b/src/ArduinoJson/Data/ValueSetter.hpp index 607514ba..7eb3ed63 100644 --- a/src/ArduinoJson/Data/ValueSetter.hpp +++ b/src/ArduinoJson/Data/ValueSetter.hpp @@ -15,22 +15,21 @@ namespace ArduinoJson { namespace Internals { -template +template struct ValueSetter { template - static bool set(JsonBuffer*, TDestination& destination, - const TSource& source) { + static bool set(JsonBuffer*, TDestination& destination, TSourceRef source) { destination = source; return true; } }; -template -struct ValueSetter::should_duplicate>::type> { +template +struct ValueSetter::should_duplicate>::type> { template static bool set(JsonBuffer* buffer, TDestination& destination, - const TSource& source) { + TSourceRef source) { const char* copy = buffer->strdup(source); if (!copy) return false; destination = copy; @@ -38,12 +37,11 @@ struct ValueSetter -struct ValueSetter::should_duplicate>::type> { +template +struct ValueSetter::should_duplicate>::type> { template - static bool set(JsonBuffer*, TDestination& destination, - const TSource& source) { + static bool set(JsonBuffer*, TDestination& destination, TSourceRef source) { // unsigned char* -> char* destination = reinterpret_cast(source); return true; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e1abcef0..1e34ec32 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,6 +29,12 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") -Wstrict-overflow=5 -Wundef ) + + if(NOT MINGW) + add_compile_options( + -std=c++98 + ) + endif() endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")