Repository navigation
Conversation
fhgffy
marked this pull request as ready for review
October 5, 2026 00:18
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ordered_hash::max_load_factor(float)calculates a clamped value in[0.1, 0.95], then immediately overwrites it with the original argument. This assignment was left behind when the earlier if/else clamping was converted toclampin 899bd13.As a result, an ordinary
ordered_set<int>{3, 1, 2}with a requested load factor of0.05for0.99fwrites that unclamped value into its serialized header. Deserializing the library's own output then throwsInvalid max_load_factor, both with and without hash compatibility. The same shared setter is used byordered_map.Change
Remove the redundant assignment so both the stored factor and the growth threshold use the existing clamped value. There is no change to the serialization format or the clamp implementation. Previously saved data containing an out-of-range factor remains rejected; this fix does not migrate those files.
Add regression coverage across the existing map/set test types, including vector/deque storage, strings, collision-heavy hashes and move-only values. The tests check lower/upper bounds and an in-range value, empty/populated containers, serialized header fields and both deserialization modes.
Validation
On the unmodified production header, all 88 existing test cases passed and all 11 new regression cases failed. The standalone roundtrip reproduction failed for both requested factors in both deserialization modes.
With the fix, all 99 test cases pass on Linux x86_64 with GCC 14.2:
-O2)-fno-exceptionsThe same four upstream test translation units were compiled directly with the repository warning/assertion flags and an existing Boost.Test 1.93 shared library because a static Boost.Test library was unavailable for the repository's CMake configuration. The Boost.Test library itself was not sanitizer-instrumented. LeakSanitizer was disabled due to the environment's ptrace limitation. Clang, MSVC, macOS, 32-bit and C++ module builds were not run.