[support] ParentIndexIterator: Add subscript and friend plus operators#8916
Merged
Conversation
Member
Author
|
Apparently we don't have any pure libc++ testing in binaryen CI:
|
sbc100
force-pushed
the
fix-parent-index-iterator
branch
2 times, most recently
from
July 17, 2026 21:23
9dd8124 to
12cb793
Compare
sbc100
force-pushed
the
fix-parent-index-iterator
branch
from
July 17, 2026 23:15
12cb793 to
ce0d0d4
Compare
Member
Author
|
I'm going to wait before landing to confirm that #8917 fails in CI (without this change) |
`ParentIndexIterator` declares `using iterator_category =` `std::random_access_iterator_tag;`, but did not provide the subscript operator (`operator[]`) or friend commutative addition (`friend operator+(difference_type, const ParentIndexIterator&)`). When `ConstraintAnalysis: Remove older redundant constraints` (#8912) introduced `std::sort(begin(), end())` on `AndedConstraintSet` (which inherits from `inplace_vector`), building `binaryen` failed on the Chromium `emscripten-releases` macOS builders with: error: type 'wasm::inplace_vector<...>::Iterator' does not provide a subscript operator This failure did not show up on Binaryen's CI because `libstdc++` implements `std::sort` using pointer/iterator addition and dereferencing (`*(first + child)`). In contrast, on macOS with `-stdlib=libc++`, `libc++` implements `std::sort` (`std::__sift_down`) using `__first[__child]` and `__first[__start]`, which requires `operator[]`. This commit adds `decltype(auto) operator[]` and `friend operator+` to `ParentIndexIterator` to satisfy `RandomAccessIterator` requirements. Are we missing CI testing for stdlib=libc++?
sbc100
force-pushed
the
fix-parent-index-iterator
branch
from
July 18, 2026 00:08
ce0d0d4 to
b75d8e0
Compare
Member
Author
|
Sadly I can't repro with #8917 since it only repros is newer version of libc++ |
sbc100
enabled auto-merge (squash)
July 18, 2026 00:08
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.
ParentIndexIteratordeclaresusing iterator_category =std::random_access_iterator_tag;, but did not provide the subscript operator (operator[]) or friend commutative addition (friend operator+(difference_type, const ParentIndexIterator&)).When #8912 introduced
std::sort(begin(), end())onAndedConstraintSet(which inherits frominplace_vector), buildingbinaryenfailed on the Chromiumemscripten-releasesmacOS builders with:This failure did not show up on Binaryen's CI because
libstdc++implementsstd::sortusing pointer/iterator addition and dereferencing (*(first + child)). In contrast, on macOS with-stdlib=libc++,libc++implementsstd::sort(std::__sift_down) using__first[__child]and__first[__start], which requiresoperator[].This commit adds
decltype(auto) operator[]andfriend operator+toParentIndexIteratorto satisfyRandomAccessIteratorrequirements.