From 11432253a10f40a8ec30328d453c85e30ecf2b54 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Wed, 11 Jan 2017 10:17:27 +0100 Subject: [PATCH] Fixed error when assigning a `volatile int` to a `JsonVariant` (issue #415) --- CHANGELOG.md | 5 +++++ include/ArduinoJson/TypeTraits/IsBaseOf.hpp | 2 +- test/JsonObject_Subscript_Tests.cpp | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80637ef6..c1980393 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ ArduinoJson: change log ======================= +HEAD +---- + +* Fixed error when assigning a `volatile int` to a `JsonVariant` (issue #415) + v5.8.0 ------ diff --git a/include/ArduinoJson/TypeTraits/IsBaseOf.hpp b/include/ArduinoJson/TypeTraits/IsBaseOf.hpp index b8375b0c..a090eab3 100644 --- a/include/ArduinoJson/TypeTraits/IsBaseOf.hpp +++ b/include/ArduinoJson/TypeTraits/IsBaseOf.hpp @@ -19,7 +19,7 @@ class IsBaseOf { typedef char No[2]; static Yes &probe(const TBase *); - static No &probe(const void *); + static No &probe(...); public: enum { diff --git a/test/JsonObject_Subscript_Tests.cpp b/test/JsonObject_Subscript_Tests.cpp index 21c3034a..6cadd3f0 100644 --- a/test/JsonObject_Subscript_Tests.cpp +++ b/test/JsonObject_Subscript_Tests.cpp @@ -38,6 +38,15 @@ TEST_(StoreInteger) { EXPECT_FALSE(_object["hello"].is()); } +TEST_(StoreVolatileInteger) { // issue #415 + volatile int i = 123; + _object["hello"] = i; + + EXPECT_EQ(123, _object["hello"].as()); + EXPECT_TRUE(_object["hello"].is()); + EXPECT_FALSE(_object["hello"].is()); +} + TEST_(StoreDouble) { _object["hello"] = 123.45;