Fix CI: name the unsigned overload type through template parameters

basic_json used number_unsigned_overload_t<basic_json> while the class was
still incomplete. MSVC rejected it as a recursive alias declaration and GCC
4.9, 5 and 7 crashed with an internal compiler error. basic_json now uses
number_unsigned_overload_type<NumberIntegerType, NumberUnsignedType>, which
also makes the GCC 5 workaround in the patch test unnecessary.

Infer reported a null dereference for the number_unsigned case in
from_json, which cannot happen for a basic_json whose number_unsigned_t is
number_integer_t; assert it.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-14 08:41:58 +02:00
1 parent ffa987ac40
commit d5e51d03c0
5 files changed
+48 -21

No files matched your search

-3
View File
@@ -157,10 +157,7 @@ TEST_CASE_TEMPLATE("same type for number_integer_t and number_unsigned_t", Json,
{
const Json source = Json::parse(R"({"a": [1, 2, 3], "b": 4})");
const Json target = Json::parse(R"({"a": [1, 5], "c": 6})");
// GCC 5 crashes with an internal compiler error when instantiating patch_inplace for this type
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 6
CHECK(source.patch(Json::diff(source, target)) == target);
#endif
CHECK(source.flatten().unflatten() == source);
}