cmake/test.cmake only adds the _cpp17/_cpp20 variants of a unit test if the
file mentions JSON_HAS_CPP_17/JSON_HAS_CPP_20. Several files have sections
that need C++17 or C++20 (std::filesystem::path, std::string_view, char8_t,
std::u8string, operator<=>, ranges) but never mention the macros, so by
default these sections were only compiled away in the C++11 build and only
ran in the CI jobs that force a standard.
Mention the macros next to the guarded sections, as the other tests do:
unit-to_json-rvalue.cpp (C++17 and C++20), unit-json_view_builder.cpp
(C++17), unit-class_parser.cpp, unit-recursion_depth_limit.cpp,
unit-ubjson_valueless.cpp, unit-custom-number-types.cpp and
unit-allocator.cpp (C++20).
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
* Fix develop CI: GCC 4.8, Clang 3.4 and clang-tidy errors
- unit-json_patch.cpp: move multi-line raw strings out of CHECK(), which
GCC 4.8 cannot parse inside a macro argument
- unit-recursion_depth_limit.cpp: value-initialize the const std::hash
(Clang 3.4 rejects default initialization of a const object)
- json_view: silence modernize-use-transparent-functors (std::less<> is
C++14), bugprone-suspicious-stringview-data-usage (the length comes from
the node) and the deliberate use-after-clear() / owning-memory hits in
unit-json_view_builder.cpp; use a raw string literal there
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
* Fix clang-tidy errors in the std::u8string tests
Test the lvalue path with the const original instead of a mutable copy
and the rvalue path with a temporary (misc-const-correctness), and mark
the intentional char8_t array with NOLINT (avoid-c-arrays).
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
---------
Signed-off-by: Niels Lohmann <mail@nlohmann.me>