Compare commits

...
Author SHA1 Message Date
Claude 27bb251d17 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>
2026-11-02 09:52:13 +00:00
2 changed files with 4 additions and 2 deletions

No files matched your search

+3 -2
View File
@@ -534,9 +534,10 @@ TEST_CASE("object_key_index")
// the hashes are not distinct on purpose: elements with the same // the hashes are not distinct on purpose: elements with the same
// hash are told apart by the caller // 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; std::vector<std::size_t> hashes;
+1
View File
@@ -1555,6 +1555,7 @@ TEST_CASE("regression tests 1")
{ {
my_json j = make(); my_json j = make();
#ifdef JSON_NO_THREAD_LOCAL #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 // the objects below the outermost one are not copied by their
// object_t here, but member by member, which keeps their // object_t here, but member by member, which keeps their
// timestamps correct: "c" is not mistaken for "b" and is inserted // timestamps correct: "c" is not mistaken for "b" and is inserted