summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/ReverseIterationTest.cpp
diff options
context:
space:
mode:
authorAbhilash Bhandari <abhilash_bhandari@yahoo.co.in>2016-12-30 12:34:36 +0000
committerAbhilash Bhandari <abhilash_bhandari@yahoo.co.in>2016-12-30 12:34:36 +0000
commita8d45de6ce8afbb529a24887ec7d8d66c3b9e04a (patch)
treefa575be2b3826868c66506e7153d7196e25c5a17 /llvm/unittests/ADT/ReverseIterationTest.cpp
parent0a92402436d04d86eddc2209a6eb6f0186155ecb (diff)
downloadbcm5719-llvm-a8d45de6ce8afbb529a24887ec7d8d66c3b9e04a.tar.gz
bcm5719-llvm-a8d45de6ce8afbb529a24887ec7d8d66c3b9e04a.zip
[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
Diffstat (limited to 'llvm/unittests/ADT/ReverseIterationTest.cpp')
-rw-r--r--llvm/unittests/ADT/ReverseIterationTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/ReverseIterationTest.cpp b/llvm/unittests/ADT/ReverseIterationTest.cpp
index 9235ecd7432..a1fd3b26d4e 100644
--- a/llvm/unittests/ADT/ReverseIterationTest.cpp
+++ b/llvm/unittests/ADT/ReverseIterationTest.cpp
@@ -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
OpenPOWER on IntegriCloud