Fix C++20/gcc-12 issues (Part 1) (#3379)

* 🔧 use proper GCC binary

* 🔧 add more GCC warning flags

* ⚗️ try fix from https://github.com/nlohmann/json/issues/3138#issuecomment-1015562666

* Fix custom allocator test build failures (C++20)

Allocator tests fail to compile in C++20 mode with clang+MS STL due
to missing copy constructors.

* Fix test build failures due to missing noexcept (gcc-12)

* alt_string has multiple member functions that should be marked noexcept.
* nlohmann::ordered_map constructors can be noexcept.

Compilation failures result from the warning flag -Werror=noexcept and
gcc-12.

* Disable broken comparison tests in C++20 mode

Co-authored-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Florian Albrechtskirchinger
2022-03-07 22:19:28 +01:00
committed by GitHub
parent 4a6e6ca8c7
commit f208a9c19b
8 changed files with 47 additions and 13 deletions

View File

@@ -271,7 +271,10 @@ std::string* sax_no_exception::error_string = nullptr;
template<class T>
class my_allocator : public std::allocator<T>
{};
{
public:
using std::allocator<T>::allocator;
};
/////////////////////////////////////////////////////////////////////
// for #3077
@@ -338,7 +341,7 @@ TEST_CASE("regression tests 2")
]
})";
json::parser_callback_t cb = [&](int /*level*/, json::parse_event_t event, json & parsed)
json::parser_callback_t cb = [&](int /*level*/, json::parse_event_t event, json & parsed) noexcept
{
// skip uninteresting events
if (event == json::parse_event_t::value && !parsed.is_primitive())