Add missing <algorithm>/<iterator> includes in Serialization.hpp and Results.hpp - #348
Open
jonathon-bell wants to merge 1 commit into
Open
jonathon-bell wants to merge 1 commit into
jonathon-bell wants to merge 1 commit into
Conversation
…Results.hpp Serialization.hpp uses std::copy and std::distance but includes neither <algorithm> nor <iterator>. Results.hpp uses std::back_inserter but does not include <iterator>. Both previously built only because some other transitively-included header happened to pull these in; that incidental path doesn't hold on all standard library versions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
These two headers use standard library facilities without including the headers that declare them — they always relied on some other header pulling in
<algorithm>/<iterator>transitively. That's incidental, not guaranteed by the standard, and recent libc++ releases (Clang 23) no longer do it, so the build now fails:Serialization.hppusesstd::copyandstd::distancebut includes neither<algorithm>nor<iterator>.Results.hppusesstd::back_inserterbut does not include<iterator>.Fix: add the missing includes directly to the headers that use them (IWYU). Reproduces the same way under
-std=gnu++11(rapidcheck's own project default) as under later standards — this isn't a C++17/20/23 compatibility issue, just a newer standard library shuffling its internal include graph. Same category as #345 (missing<exception>inGen.hpp).This should hold regardless of whether it reproduces on any particular CI toolchain: the standard never specifies that
<unordered_map>/<string>/etc. must provide<algorithm>or<iterator>, so code relying on that is fragile by construction even where it currently happens to build. The fix is a pure addition of includes — zero behavioral change, and it cannot break any configuration that builds today.Environment used to reproduce and verify: macOS, Clang 23.1.0, libc++, CMake, default
-std=gnu++11(rapidcheck's own build default — verified viacmake --build, independent of any consuming project's language standard).Verified
cmake --buildsucceeds for therapidchecktarget after the fix.