diff --git a/tests/src/unit-allocator.cpp b/tests/src/unit-allocator.cpp index e1dee5509..ea9386fcb 100644 --- a/tests/src/unit-allocator.cpp +++ b/tests/src/unit-allocator.cpp @@ -1038,6 +1038,14 @@ template struct sweep_allocator { using value_type = T; + // GCC 4.8's std::map takes these from the allocator instead of from + // std::allocator_traits + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; sweep_allocator() = default; template sweep_allocator(const sweep_allocator& /*unused*/) noexcept {} @@ -1155,8 +1163,9 @@ TEST_CASE("parse() survives a failing allocation at every point (#5985)") // With iterator debugging (MSVC STL debug builds, also used by clang-cl), // containers allocate a debug proxy through the allocator inside their - // noexcept move constructors, so failing that allocation terminates the - // program instead of throwing std::bad_alloc. Nothing to check there. + // noexcept default and move constructors, so failing that allocation + // terminates the program instead of throwing std::bad_alloc. Nothing to + // check there. #if !(defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL > 0) SECTION("parser callback") { @@ -1178,7 +1187,6 @@ TEST_CASE("parse() survives a failing allocation at every point (#5985)") return sweep_json::parse(text, drop_d); }); } -#endif SECTION("sax_parse into an existing value") { @@ -1192,5 +1200,6 @@ TEST_CASE("parse() survives a failing allocation at every point (#5985)") return value; }); } +#endif } #endif diff --git a/tests/src/unit-class_lexer.cpp b/tests/src/unit-class_lexer.cpp index 0e8b22317..616999896 100644 --- a/tests/src/unit-class_lexer.cpp +++ b/tests/src/unit-class_lexer.cpp @@ -2222,9 +2222,10 @@ TEST_CASE("serialization of short strings") { CAPTURE(s) const json j = s; - CHECK(j.dump() == "\"" + s + "\""); - CHECK(j.dump(-1, ' ', true) == "\"" + s + "\""); - CHECK(json({{s, s}}).dump() == "{\"" + s + "\":\"" + s + "\"}"); + const std::string quoted = "\"" + s + "\""; // NOLINT(performance-inefficient-string-concatenation) + CHECK(j.dump() == quoted); + CHECK(j.dump(-1, ' ', true) == quoted); + CHECK(json({{s, s}}).dump() == "{" + quoted + ":" + quoted + "}"); // NOLINT(performance-inefficient-string-concatenation) } // a character that needs an escape diff --git a/tests/src/unit-json_view.cpp b/tests/src/unit-json_view.cpp index e383dbdac..de902bde7 100644 --- a/tests/src/unit-json_view.cpp +++ b/tests/src/unit-json_view.cpp @@ -111,7 +111,7 @@ struct failing_allocator template explicit failing_allocator(const failing_allocator& /*other*/) noexcept {} - T* allocate(std::size_t /*n*/) // NOLINT(readability-convert-member-functions-to-static) + [[noreturn]] T* allocate(std::size_t /*n*/) // NOLINT(readability-convert-member-functions-to-static) { throw std::bad_alloc(); } diff --git a/tests/src/unit-msgpack-cpp17.cpp b/tests/src/unit-msgpack-cpp17.cpp index 6b6b207bf..8b2349b90 100644 --- a/tests/src/unit-msgpack-cpp17.cpp +++ b/tests/src/unit-msgpack-cpp17.cpp @@ -122,7 +122,8 @@ TEST_CASE("JSON text with std::byte") SECTION("invalid text") { CHECK_FALSE(json::accept(to_bytes("[1,\n2,"))); - CHECK_THROWS_WITH_AS(json::parse(to_bytes("[1,\n2,")), + json _; + CHECK_THROWS_WITH_AS(_ = json::parse(to_bytes("[1,\n2,")), "[json.exception.parse_error.101] parse error at line 2, column 3: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&); } }