Commit 12cb793
committed
[support] ParentIndexIterator: Add subscript and friend plus operators
`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++?1 parent ebd7454 commit 12cb793
3 files changed
Lines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
| |||
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
0 commit comments