Tests: skip the parse() allocation sweep with MSVC iterator debugging

With _ITERATOR_DEBUG_LEVEL > 0 (MSVC STL debug builds, clang-cl), containers
allocate inside noexcept functions, so a failing allocation terminates the
program: "test case CRASHED: Terminate handler called" in the sax_parse
subcase of #5985. The sweep test of #6000 has the same guard.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-11-02 19:12:26 +01:00
1 parent eaee875178
commit d7a7534872
1 file changed
+4 -1
+4 -1
View File
@@ -1026,7 +1026,10 @@ TEST_CASE("insert() provides its documented exception guarantees (#5986)")
}
#endif
#if !defined(JSON_NOEXCEPTION)
// the no-exceptions CI job has no std::bad_alloc to catch; with iterator
// debugging (MSVC STL debug builds) containers allocate inside noexcept
// functions, so failing an allocation there terminates the program
#if !defined(JSON_NOEXCEPTION) && !(defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL > 0)
namespace
{
// the allocation numbered sweep_fail_at (counted from 1) throws; 0 never fails