diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index b19ec5757..232b49d24 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp @@ -529,10 +529,10 @@ class json_pointer static std::size_t hash_of(std::size_t parent, const string_t& token) noexcept { - std::size_t h = parent * static_cast(0x9E3779B97F4A7C15ULL); + std::size_t h = parent * static_cast(0x9E3779B97F4A7C15ULL & static_cast((std::numeric_limits::max)())); for (std::size_t i = 0; i < token.size(); ++i) { - h = (h ^ static_cast(token[i])) * static_cast(0x100000001B3ULL); + h = (h ^ static_cast(token[i])) * static_cast(0x100000001B3ULL & static_cast((std::numeric_limits::max)())); } return h ^ (h >> 29u); } diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index a05071e9d..595fe11e5 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -1225,7 +1225,7 @@ public: } template < typename O = object_t, detail::enable_if_t < detail::has_stable_elements::value, int > = 0 > - static constexpr std::size_t object_capacity() noexcept + std::size_t object_capacity() const noexcept { return 0; } @@ -1237,7 +1237,7 @@ public: } template < typename O = object_t, detail::enable_if_t < !detail::has_stable_elements::value && !detail::is_nlohmann_ordered_map::value, int > = 0 > - static constexpr std::size_t object_capacity() noexcept + std::size_t object_capacity() const noexcept { return detail::unknown_size(); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index cae524061..68d6b5bec 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -21502,10 +21502,10 @@ class json_pointer static std::size_t hash_of(std::size_t parent, const string_t& token) noexcept { - std::size_t h = parent * static_cast(0x9E3779B97F4A7C15ULL); + std::size_t h = parent * static_cast(0x9E3779B97F4A7C15ULL & static_cast((std::numeric_limits::max)())); for (std::size_t i = 0; i < token.size(); ++i) { - h = (h ^ static_cast(token[i])) * static_cast(0x100000001B3ULL); + h = (h ^ static_cast(token[i])) * static_cast(0x100000001B3ULL & static_cast((std::numeric_limits::max)())); } return h ^ (h >> 29u); } @@ -31290,7 +31290,7 @@ public: } template < typename O = object_t, detail::enable_if_t < detail::has_stable_elements::value, int > = 0 > - static constexpr std::size_t object_capacity() noexcept + std::size_t object_capacity() const noexcept { return 0; } @@ -31302,7 +31302,7 @@ public: } template < typename O = object_t, detail::enable_if_t < !detail::has_stable_elements::value && !detail::is_nlohmann_ordered_map::value, int > = 0 > - static constexpr std::size_t object_capacity() noexcept + std::size_t object_capacity() const noexcept { return detail::unknown_size(); } diff --git a/tests/src/unit-diagnostics.cpp b/tests/src/unit-diagnostics.cpp index 1d7b45a97..504a95322 100644 --- a/tests/src/unit-diagnostics.cpp +++ b/tests/src/unit-diagnostics.cpp @@ -817,8 +817,8 @@ template, struct relocating_map : nlohmann::ordered_map { using base_type = nlohmann::ordered_map; - using typename base_type::iterator; - using typename base_type::Container; + using iterator = typename base_type::iterator; + using Container = typename base_type::Container; using base_type::base_type; template