Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit e53904e

Browse files
author
Zachary Turner
committed
Fix build due to comparison of std::pairs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283342 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 5844b06 commit e53904e

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

unittests/ADT/STLExtrasTest.cpp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,28 @@ TEST(STLExtrasTest, EnumerateLValue) {
4343
// Test that a simple LValue can be enumerated and gives correct results with
4444
// multiple types, including the empty container.
4545
std::vector<char> foo = {'a', 'b', 'c'};
46-
std::vector<std::pair<std::size_t, char>> CharResults;
46+
typedef std::pair<std::size_t, char> CharPairType;
47+
std::vector<CharPairType> CharResults;
4748

4849
for (auto X : llvm::enumerate(foo)) {
4950
CharResults.emplace_back(X.Index, X.Value);
5051
}
5152
ASSERT_EQ(3u, CharResults.size());
52-
EXPECT_EQ(std::make_pair(0u, 'a'), CharResults[0]);
53-
EXPECT_EQ(std::make_pair(1u, 'b'), CharResults[1]);
54-
EXPECT_EQ(std::make_pair(2u, 'c'), CharResults[2]);
53+
EXPECT_EQ(CharPairType(0u, 'a'), CharResults[0]);
54+
EXPECT_EQ(CharPairType(1u, 'b'), CharResults[1]);
55+
EXPECT_EQ(CharPairType(2u, 'c'), CharResults[2]);
5556

5657
// Test a const range of a different type.
57-
std::vector<std::pair<std::size_t, int>> IntResults;
58+
typedef std::pair<std::size_t, int> IntPairType;
59+
std::vector<IntPairType> IntResults;
5860
const std::vector<int> bar = {1, 2, 3};
5961
for (auto X : llvm::enumerate(bar)) {
6062
IntResults.emplace_back(X.Index, X.Value);
6163
}
6264
ASSERT_EQ(3u, IntResults.size());
63-
EXPECT_EQ(std::make_pair(0u, 1), IntResults[0]);
64-
EXPECT_EQ(std::make_pair(1u, 2), IntResults[1]);
65-
EXPECT_EQ(std::make_pair(2u, 3), IntResults[2]);
65+
EXPECT_EQ(IntPairType(0u, 1), IntResults[0]);
66+
EXPECT_EQ(IntPairType(1u, 2), IntResults[1]);
67+
EXPECT_EQ(IntPairType(2u, 3), IntResults[2]);
6668

6769
// Test an empty range.
6870
IntResults.clear();
@@ -88,7 +90,8 @@ TEST(STLExtrasTest, EnumerateModifyLValue) {
8890

8991
TEST(STLExtrasTest, EnumerateRValueRef) {
9092
// Test that an rvalue can be enumerated.
91-
std::vector<std::pair<std::size_t, int>> Results;
93+
typedef std::pair<std::size_t, int> PairType;
94+
std::vector<PairType> Results;
9295

9396
auto Enumerator = llvm::enumerate(std::vector<int>{1, 2, 3});
9497

@@ -97,26 +100,27 @@ TEST(STLExtrasTest, EnumerateRValueRef) {
97100
}
98101

99102
ASSERT_EQ(3u, Results.size());
100-
EXPECT_EQ(std::make_pair(0u, 1), Results[0]);
101-
EXPECT_EQ(std::make_pair(1u, 2), Results[1]);
102-
EXPECT_EQ(std::make_pair(2u, 3), Results[2]);
103+
EXPECT_EQ(PairType(0u, 1), Results[0]);
104+
EXPECT_EQ(PairType(1u, 2), Results[1]);
105+
EXPECT_EQ(PairType(2u, 3), Results[2]);
103106
}
104107

105108
TEST(STLExtrasTest, EnumerateModifyRValue) {
106109
// Test that when enumerating an rvalue, modification still works (even if
107110
// this isn't terribly useful, it at least shows that we haven't snuck an
108111
// extra const in there somewhere.
109-
std::vector<std::pair<std::size_t, char>> Results;
112+
typedef std::pair<std::size_t, char> PairType;
113+
std::vector<PairType> Results;
110114

111115
for (auto X : llvm::enumerate(std::vector<char>{'1', '2', '3'})) {
112116
++X.Value;
113117
Results.emplace_back(X.Index, X.Value);
114118
}
115119

116120
ASSERT_EQ(3u, Results.size());
117-
EXPECT_EQ(std::make_pair(0u, '2'), Results[0]);
118-
EXPECT_EQ(std::make_pair(1u, '3'), Results[1]);
119-
EXPECT_EQ(std::make_pair(2u, '4'), Results[2]);
121+
EXPECT_EQ(PairType(0u, '2'), Results[0]);
122+
EXPECT_EQ(PairType(1u, '3'), Results[1]);
123+
EXPECT_EQ(PairType(2u, '4'), Results[2]);
120124
}
121125

122126
template <bool B> struct CanMove {};

0 commit comments

Comments
 (0)