summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit5b451063264fefe7445421879d7a9bff692ebd83 (patch)
tree5c037135fd5e6dcbf4e3dcc88d5e0316244c4288 /llvm/unittests/ADT/IteratorTest.cpp
parent73dbe863002a5ca05f2fd1ed6163b010a885e637 (diff)
downloadbcm5719-llvm-5b451063264fefe7445421879d7a9bff692ebd83.tar.gz
bcm5719-llvm-5b451063264fefe7445421879d7a9bff692ebd83.zip
[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. llvm-svn: 335698
Diffstat (limited to 'llvm/unittests/ADT/IteratorTest.cpp')
-rw-r--r--llvm/unittests/ADT/IteratorTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/IteratorTest.cpp b/llvm/unittests/ADT/IteratorTest.cpp
index 341049a6847..3bcdfa90846 100644
--- a/llvm/unittests/ADT/IteratorTest.cpp
+++ b/llvm/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};
OpenPOWER on IntegriCloud