Split the two object types apart

AppVeyor failed with only unit-custom-object-type.cpp enabled and passed with
all three new translation units disabled, so the cause is one of the two
object types in this file and not the array or binary ones.

Guard out void_erase_map and leave no_key_compare_map, which separates the two
constructs under suspicion: shadowing the inherited key_compare member type
with an entity that is not a type, and hiding the inherited erase with a
void-returning overload. A failure here points at the first, a pass at the
second. Still temporary.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-09-01 02:02:14 +00:00
parent 911273162a
commit a85063ea52
+9
View File
@@ -49,6 +49,11 @@ struct no_key_compare_map : std::map<Key, T, Compare, Allocator>
using no_key_compare_json = nlohmann::basic_json<no_key_compare_map>;
// TEMPORARY: guarded out to split this translation unit's two object types
// while narrowing down an AppVeyor failure on MSVC 2015/2017 whose build log
// this environment cannot reach. The macro is deliberately never defined.
#ifdef JSON_BISECT_CUSTOM_CONTAINER_TESTS
// An ObjectType whose erase(iterator) returns void rather than the following
// iterator, as for instance Abseil's hash maps do
template<class Key, class T, class Compare, class Allocator>
@@ -66,8 +71,11 @@ struct void_erase_map : std::map<Key, T, Compare, Allocator>
using void_erase_json = nlohmann::basic_json<void_erase_map>;
#endif
} // namespace
#ifdef JSON_BISECT_CUSTOM_CONTAINER_TESTS
TEST_CASE("object type whose erase() returns void")
{
SECTION("erasing every element through the returned iterator")
@@ -117,6 +125,7 @@ TEST_CASE("object type whose erase() returns void")
CHECK(j.empty());
}
}
#endif
TEST_CASE("object type without key_compare")
{