mirror of
https://github.com/nlohmann/json.git
synced 2026-06-18 18:34:17 +00:00
Compare commits
3 Commits
bson-sizes
...
issue4440
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fd3913e4e | |||
| 2030ba3944 | |||
| c51c9cefea |
@@ -137,6 +137,15 @@
|
|||||||
// ranges header shipping in GCC 11.1.0 (released 2021-04-27) has a syntax error
|
// ranges header shipping in GCC 11.1.0 (released 2021-04-27) has a syntax error
|
||||||
#if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427
|
#if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427
|
||||||
#define JSON_HAS_RANGES 0
|
#define JSON_HAS_RANGES 0
|
||||||
|
// libstdc++ < 11 has incomplete C++20 ranges (issue #4440)
|
||||||
|
#elif defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 11
|
||||||
|
#define JSON_HAS_RANGES 0
|
||||||
|
// libc++ < 16 has incomplete C++20 ranges (issue #4440)
|
||||||
|
#elif defined(__clang__) && !defined(__apple_build_version__) \
|
||||||
|
&& __clang_major__ < 16 && defined(__GLIBCXX__)
|
||||||
|
#define JSON_HAS_RANGES 0
|
||||||
|
#elif defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 160000
|
||||||
|
#define JSON_HAS_RANGES 0
|
||||||
#elif defined(__cpp_lib_ranges)
|
#elif defined(__cpp_lib_ranges)
|
||||||
#define JSON_HAS_RANGES 1
|
#define JSON_HAS_RANGES 1
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -2501,6 +2501,15 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
|||||||
// ranges header shipping in GCC 11.1.0 (released 2021-04-27) has a syntax error
|
// ranges header shipping in GCC 11.1.0 (released 2021-04-27) has a syntax error
|
||||||
#if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427
|
#if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427
|
||||||
#define JSON_HAS_RANGES 0
|
#define JSON_HAS_RANGES 0
|
||||||
|
// libstdc++ < 11 has incomplete C++20 ranges (issue #4440)
|
||||||
|
#elif defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 11
|
||||||
|
#define JSON_HAS_RANGES 0
|
||||||
|
// libc++ < 16 has incomplete C++20 ranges (issue #4440)
|
||||||
|
#elif defined(__clang__) && !defined(__apple_build_version__) \
|
||||||
|
&& __clang_major__ < 16 && defined(__GLIBCXX__)
|
||||||
|
#define JSON_HAS_RANGES 0
|
||||||
|
#elif defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 160000
|
||||||
|
#define JSON_HAS_RANGES 0
|
||||||
#elif defined(__cpp_lib_ranges)
|
#elif defined(__cpp_lib_ranges)
|
||||||
#define JSON_HAS_RANGES 1
|
#define JSON_HAS_RANGES 1
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ using ordered_json = nlohmann::ordered_json;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// for #4440
|
||||||
|
#if JSON_HAS_RANGES == 1
|
||||||
|
#include <ranges>
|
||||||
|
#endif
|
||||||
|
|
||||||
// NLOHMANN_JSON_SERIALIZE_ENUM uses a static std::pair
|
// NLOHMANN_JSON_SERIALIZE_ENUM uses a static std::pair
|
||||||
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
|
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
|
||||||
DOCTEST_CLANG_SUPPRESS_WARNING("-Wexit-time-destructors")
|
DOCTEST_CLANG_SUPPRESS_WARNING("-Wexit-time-destructors")
|
||||||
@@ -1134,6 +1139,20 @@ TEST_CASE("regression tests 2")
|
|||||||
CHECK(!result.has_value());
|
CHECK(!result.has_value());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if JSON_HAS_RANGES == 1
|
||||||
|
SECTION("issue #4440 - assert when using std::views::filter and GCC 10")
|
||||||
|
{
|
||||||
|
auto noOpFilter = std::views::filter([](auto&&) noexcept
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
json j = {1, 2, 3};
|
||||||
|
auto filtered = j | noOpFilter;
|
||||||
|
CHECK(*filtered.begin() == 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_TEMPLATE("issue #4798 - nlohmann::json::to_msgpack() encode float NaN as double", T, double, float) // NOLINT(readability-math-missing-parentheses, bugprone-throwing-static-initialization)
|
TEST_CASE_TEMPLATE("issue #4798 - nlohmann::json::to_msgpack() encode float NaN as double", T, double, float) // NOLINT(readability-math-missing-parentheses, bugprone-throwing-static-initialization)
|
||||||
|
|||||||
Reference in New Issue
Block a user