Repository navigation
Include <cstdlib> where free() is used in polyxx - #117
Merged
Merged
Conversation
polynomial.cpp, upolynomial.cpp and utils.cpp call free() without including a header that declares it, relying on transitive includes. libc++ 23 no longer provides <cstdlib> that way, so the build fails with "use of undeclared identifier 'free'". Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ajreynol
pushed a commit
to ajreynol/cvc5
that referenced
this pull request
Nov 20, 2026
libc++ 23 changed two implementation details that break the build: - Its headers no longer include `<vector>` transitively, so `preprocessing_pass_registry.h`, which uses `std::vector` without including `<vector>`, fails to compile. This PR adds the missing include. - It provides `std::hash` for integer types through the primary template instead of explicit specializations. The configure probe for `CVC5_NEED_HASH_UINT64_T_OVERLOAD` inferred that `std::hash<uint64_t>` is missing whenever an explicit specialization of it compiles. Under libc++ 23 the probe passes, and `util/hash.h` then specializes `std::hash<uint64_t>` after the standard library has already instantiated it. Since C++11, the standard library must provide `std::hash` for all integer types, so this PR removes the probe and the fallback specialization. Both date back to 2012 (c0377cd), when they targeted the non-standard `__gnu_cxx::hash` of GNU's `hash_map` extension, and they have been obsolete since the move to C++11's `std::hash` in 2017 (8b0659e), which converted them by renaming the namespace. Both problems come from libc++, not from the compiler: clang 23 with libstdc++ is unaffected. Tested with clang 23.1.5 and libc++ 23 (LLVM release binaries) in a debug build, where all unit tests and all `regress0` tests pass. For that run, libpoly needed a local patch, because its C++ wrapper also calls `free` without including `<cstdlib>`. That problem is in libpoly and is not addressed here; it is fixed upstream by SRI-CSL/libpoly#117, which is not yet part of a libpoly release. Fixes cvc5#13188. Fixes cvc5#13189. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.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.
Fixes #116.
src/polyxx/polynomial.cpp,upolynomial.cppandutils.cppcallfree()without including a header that declares it. They only compiled because another standard header happened to pull in<cstdlib>; libc++ 23 no longer does, so the build fails withuse of undeclared identifier 'free'.This adds
#include <cstdlib>to the three files. No other changes.Testing: the existing ctest suite passes (16/16) on Apple clang 17. I could not reproduce the original failure on this toolchain (it depends on libc++ 23's header layout), so no regression test is added.
🤖 Generated with Claude Code