forked from OSchip/llvm-project
[ADT] Fix for compilation error when operator++(int) (post-increment function) of SmallPtrSetIterator is used.
The bug was introduced in r289619. Reviewers: Mehdi Amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28134 llvm-svn: 290749
This commit is contained in:
parent
0a92402436
commit
a8d45de6ce
|
@ -290,12 +290,6 @@ public:
|
|||
|
||||
SmallPtrSetIterator operator++(int) { // Postincrement
|
||||
SmallPtrSetIterator tmp = *this;
|
||||
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
if (ReverseIterate<bool>::value) {
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
#endif
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
|
|
@ -31,9 +31,22 @@ TEST(ReverseIterationTest, SmallPtrSetTest) {
|
|||
for (const auto &Tuple : zip(Set, Ptrs))
|
||||
ASSERT_EQ(std::get<0>(Tuple), std::get<1>(Tuple));
|
||||
|
||||
// Check operator++ (post-increment) in forward iteration.
|
||||
int i = 0;
|
||||
for (auto begin = Set.begin(), end = Set.end();
|
||||
begin != end; i++)
|
||||
ASSERT_EQ(*begin++, Ptrs[i]);
|
||||
|
||||
// Check reverse iteration.
|
||||
ReverseIterate<bool>::value = true;
|
||||
for (const auto &Tuple : zip(Set, ReversePtrs))
|
||||
ASSERT_EQ(std::get<0>(Tuple), std::get<1>(Tuple));
|
||||
|
||||
// Check operator++ (post-increment) in reverse iteration.
|
||||
i = 0;
|
||||
for (auto begin = Set.begin(), end = Set.end();
|
||||
begin != end; i++)
|
||||
ASSERT_EQ(*begin++, ReversePtrs[i]);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue