forked from bblanchon/ArduinoJson
@ -5,6 +5,7 @@ HEAD
|
||||
----
|
||||
|
||||
* Fix warning `function returns incomplete class type` on IAR (issue #2001)
|
||||
* Fix `volatile bool` serialized as `1` or `0` instead of `true` or `false` (issue #2029)
|
||||
|
||||
v6.21.4 (2023-12-07)
|
||||
-------
|
||||
|
@ -140,6 +140,13 @@ TEST_CASE("volatile") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonVariant variant = doc.to<JsonVariant>();
|
||||
|
||||
SECTION("volatile bool") { // issue #2029
|
||||
volatile bool f = true;
|
||||
variant.set(f);
|
||||
CHECK(variant.is<bool>() == true);
|
||||
CHECK(variant.as<bool>() == true);
|
||||
}
|
||||
|
||||
SECTION("volatile int") {
|
||||
volatile int f = 42;
|
||||
variant.set(f);
|
||||
|
@ -137,7 +137,8 @@ VariantRefBase<TDerived>::is() const {
|
||||
template <typename TDerived>
|
||||
template <typename T>
|
||||
inline bool VariantRefBase<TDerived>::set(const T& value) const {
|
||||
Converter<T>::toJson(value, getOrCreateVariant());
|
||||
Converter<typename detail::remove_cv<T>::type>::toJson(value,
|
||||
getOrCreateVariant());
|
||||
MemoryPool* pool = getPool();
|
||||
return pool && !pool->overflowed();
|
||||
}
|
||||
|
Reference in New Issue
Block a user