Fixed error expected unqualified-id on GCC 11 (fixes #1622)

This commit is contained in:
Benoit Blanchon
2021-08-03 11:39:02 +02:00
parent 1b74ad0731
commit f570fe8c37
6 changed files with 48 additions and 3 deletions

View File

@ -5,6 +5,7 @@ HEAD
---- ----
* Fixed error `'dummy' may be used uninitialized` on GCC 11 * Fixed error `'dummy' may be used uninitialized` on GCC 11
* Fixed error `expected unqualified-id before 'const'` on GCC 11 (issue #1622)
v6.18.3 (2021-07-27) v6.18.3 (2021-07-27)
------- -------

View File

@ -12,6 +12,7 @@ link_libraries(ArduinoJson catch)
include_directories(Helpers) include_directories(Helpers)
add_subdirectory(Cpp11) add_subdirectory(Cpp11)
add_subdirectory(Cpp17) add_subdirectory(Cpp17)
add_subdirectory(Cpp20)
add_subdirectory(FailingBuilds) add_subdirectory(FailingBuilds)
add_subdirectory(IntegrationTests) add_subdirectory(IntegrationTests)
add_subdirectory(JsonArray) add_subdirectory(JsonArray)

View File

@ -0,0 +1,29 @@
# ArduinoJson - https://arduinojson.org
# Copyright Benoit Blanchon 2014-2021
# MIT License
if(MSVC_VERSION LESS 1910)
return()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
return()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
return()
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(Cpp20Tests
smoke_test.cpp
)
add_test(Cpp20 Cpp20Tests)
set_tests_properties(Cpp20
PROPERTIES
LABELS "Catch"
)

View File

@ -0,0 +1,15 @@
#include <ArduinoJson.h>
#include <catch.hpp>
#include <string>
TEST_CASE("C++20 smoke test") {
StaticJsonDocument<128> doc;
deserializeJson(doc, "{\"hello\":\"world\"}");
REQUIRE(doc["hello"] == "world");
std::string json;
serializeJson(doc, json);
REQUIRE(json == "{\"hello\":\"world\"}");
}

View File

@ -45,8 +45,7 @@ class StringAdapter< ::String> {
template <> template <>
class StringAdapter< ::StringSumHelper> : public StringAdapter< ::String> { class StringAdapter< ::StringSumHelper> : public StringAdapter< ::String> {
public: public:
StringAdapter< ::StringSumHelper>(const ::String& s) StringAdapter(const ::String& s) : StringAdapter< ::String>(s) {}
: StringAdapter< ::String>(s) {}
}; };
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE

View File

@ -45,7 +45,7 @@ class StringAdapter<const char*> {
template <int N> template <int N>
class StringAdapter<const char[N]> : public StringAdapter<const char*> { class StringAdapter<const char[N]> : public StringAdapter<const char*> {
public: public:
StringAdapter<const char[N]>(const char* s) : StringAdapter<const char*>(s) {} StringAdapter(const char* s) : StringAdapter<const char*>(s) {}
}; };
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE