mirror of
https://github.com/nlohmann/json.git
synced 2026-11-02 10:55:35 +00:00
Return std::size_t from the hash helper in the ordered_json test
MSVC (Win32) rejected the implicit conversion of the unsigned long long product to the 32-bit std::size_t (C4244 as an error). Also note when JSON_NO_THREAD_LOCAL is set in the regression test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N5NasAgbDGG28MqXjQvLqp Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
2 files changed
+4
-2
No files matched your search
@@ -534,9 +534,10 @@ TEST_CASE("object_key_index")
|
||||
|
||||
// the hashes are not distinct on purpose: elements with the same
|
||||
// hash are told apart by the caller
|
||||
const auto hash_of = [](std::size_t position)
|
||||
const auto hash_of = [](std::size_t position) -> std::size_t
|
||||
{
|
||||
return (position % 50) * 0x9E3779B97F4A7C15ull;
|
||||
// truncated to 32 bits where std::size_t is that small
|
||||
return static_cast<std::size_t>((position % 50) * 0x9E3779B97F4A7C15ull);
|
||||
};
|
||||
|
||||
std::vector<std::size_t> hashes;
|
||||
|
||||
@@ -1555,6 +1555,7 @@ TEST_CASE("regression tests 1")
|
||||
{
|
||||
my_json j = make();
|
||||
#ifdef JSON_NO_THREAD_LOCAL
|
||||
// (set by the user, or by the library for clang with MinGW)
|
||||
// the objects below the outermost one are not copied by their
|
||||
// object_t here, but member by member, which keeps their
|
||||
// timestamps correct: "c" is not mistaken for "b" and is inserted
|
||||
|
||||
Reference in new issue
Block a user