Add a default constructor to llvm::SuccIterator (gcc15) - #24
Merged
akritkbehera merged 1 commit intoSep 3, 2026
Merged
Conversation
Compiling llvm/lib/IR/Dominators.cpp against the gcc15 libstdc++ fails with
stl_iterator.h:182: error: no matching constructor for initialization of
'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>'
libstdc++ 15 declares std::reverse_iterator's default constructor as
noexcept(noexcept(Iterator())). Asking whether a reverse_iterator over
succ_iterator is default constructible -- the C++20 semiregular check the
ranges code does -- forces that exception specification to be instantiated,
and an error inside an exception specification is hard rather than a SFINAE
failure, so the concept never gets to simply answer "no" and the build dies.
libstdc++ 14 has no such noexcept clause, which is why gcc14 is fine.
SuccIterator declares only the begin (InstructionT *) and end (InstructionT *,
bool) constructors, so it has no default one. PredIterator, right above it in
the same header, already carries "PredIterator() = default;" for this reason.
Add SuccIterator() : Inst(nullptr), Idx(0) {}. A null Inst with Idx == 0 is a
state the class already supports: the end-iterator constructor uses it for
malformed CFGs and index_is_valid() special cases it, so a default constructed
iterator behaves like one over a block with no successors. Zero initialising is
better than "= default" here, which would leave the pointer and the index
indeterminate. There is nothing to backport from upstream -- LLVM main has since
folded SuccIterator into Instruction.
The hunk rewrites the "// begin iterator" comment rather than being a pure
insertion, because bazel's ctx.patch (third_party/repo.bzl applies these with
strip = 1) has been seen to silently skip insertion-only hunks, as with the
oneDNN fmt_consteval patch.
|
A new Pull Request was created by @akritkbehera for branch cms/v2.21.0. @akritkbehera, @cmsbuild, @iarspider, @raoatifshad, @smuzaffar can you please review it and eventually sign? Thanks. |
|
cms-bot internal usage |
Author
|
+externals |
|
This pull request is fully signed and it will be integrated in one of the next cms/v2.21.0 IBs after it passes the integration tests. This pull request will now be reviewed by the release team before it's merged. @mandrenguyen, @ftenchini, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2) |
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.
No description provided.