diff --git a/src/json.hpp b/src/json.hpp index eadfbafa98..5e998a1f71 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -8954,7 +8954,7 @@ class basic_json else if (codepoint >= 0xDC00 and codepoint <= 0xDFFF) { // we found a lone low surrogate - throw std::invalid_argument("missing high surrogate"); + JSON_THROW(std::invalid_argument("missing high surrogate")); } else { diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 12de690409..8a2fbec4ba 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -8103,7 +8103,7 @@ class basic_json else if (codepoint >= 0xDC00 and codepoint <= 0xDFFF) { // we found a lone low surrogate - throw std::invalid_argument("missing high surrogate"); + JSON_THROW(std::invalid_argument("missing high surrogate")); } else { diff --git a/test/src/unit-allocator.cpp b/test/src/unit-allocator.cpp index 3efd0cf67b..08a65dde70 100644 --- a/test/src/unit-allocator.cpp +++ b/test/src/unit-allocator.cpp @@ -33,11 +33,11 @@ SOFTWARE. using nlohmann::json; // allow to disable exceptions -#ifndef __cpp_exceptions - #define try if (true) - #define catch(X) if (false) - #define throw(X) std::abort() -#endif +//#ifndef __cpp_exceptions +// #define try if (true) +// #define catch(X) if (false) +// #define throw(X) std::abort() +//#endif // special test case to check if memory is leaked if constructor throws @@ -51,7 +51,7 @@ struct bad_allocator : std::allocator } }; -TEST_CASE("bad_alloc") +TEST_CASE("bad_alloc", "[throw]") { SECTION("bad_alloc") { @@ -118,7 +118,7 @@ struct my_allocator : std::allocator } }; -TEST_CASE("controlled bad_alloc") +TEST_CASE("controlled bad_alloc", "[throw]") { // create JSON type using the throwing allocator using my_json = nlohmann::basic_json