summaryrefslogtreecommitdiff
path: root/unittests/ADT/IteratorTest.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2018-06-27 00:54:36 +0000
committerJustin Bogner <mail@justinbogner.com>2018-06-27 00:54:36 +0000
commit2051d2558e7ad265297164a8fe5e68a53a7926a5 (patch)
tree61f04bbf12d8ef6b42071a54e3b3dc5811edba8f /unittests/ADT/IteratorTest.cpp
parent0f220def93e058ad74f8ec4b2b93794248377e96 (diff)
[ADT] Pass DerivedT from pointe{e,r}_iterator to iterator_adaptor_base
These were passing the wrong type into iterator_adaptor_base if T was anything but the default. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335698 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ADT/IteratorTest.cpp')
-rw-r--r--unittests/ADT/IteratorTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/ADT/IteratorTest.cpp b/unittests/ADT/IteratorTest.cpp
index 341049a6847..3bcdfa90846 100644
--- a/unittests/ADT/IteratorTest.cpp
+++ b/unittests/ADT/IteratorTest.cpp
@@ -128,6 +128,20 @@ TEST(PointeeIteratorTest, Range) {
EXPECT_EQ(A[I++], II);
}
+TEST(PointeeIteratorTest, PointeeType) {
+ struct S {
+ int X;
+ bool operator==(const S &RHS) const { return X == RHS.X; };
+ };
+ S A[] = {S{0}, S{1}};
+ SmallVector<S *, 2> V{&A[0], &A[1]};
+
+ pointee_iterator<SmallVectorImpl<S *>::const_iterator, const S> I = V.begin();
+ for (int j = 0; j < 2; ++j, ++I) {
+ EXPECT_EQ(*V[j], *I);
+ }
+}
+
TEST(FilterIteratorTest, Lambda) {
auto IsOdd = [](int N) { return N % 2 == 1; };
int A[] = {0, 1, 2, 3, 4, 5, 6};