1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-28 12:02:00 +03:00

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

@ -17066,7 +17066,8 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
// Explicit constructors instead of `using Container::Container`
// otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4)
ordered_map(const Allocator& alloc = Allocator()) : Container{alloc} {}
ordered_map() noexcept(noexcept(Container())) : Container{} {}
explicit ordered_map(const Allocator& alloc) noexcept(noexcept(Container(alloc))) : Container{alloc} {}
template <class It>
ordered_map(It first, It last, const Allocator& alloc = Allocator())
: Container{first, last, alloc} {}
@ -19052,6 +19053,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template < typename ValueType, typename std::enable_if <
detail::conjunction <
detail::negation<std::is_pointer<ValueType>>,
detail::negation<std::is_same<ValueType, std::nullptr_t>>,
detail::negation<std::is_same<ValueType, detail::json_ref<basic_json>>>,
detail::negation<std::is_same<ValueType, typename string_t::value_type>>,
detail::negation<detail::is_basic_json<ValueType>>,