Fix a bunch of unordered container tests that were failing when _LIBCPP_DEBUG was set.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359642 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2019-05-01 01:52:51 +00:00
parent 35323b7f05
commit 3cae9fcd3d
18 changed files with 41 additions and 46 deletions

View File

@@ -70,7 +70,7 @@ int main(int, char**)
{ {
typedef std::unordered_map<int, std::string> C; typedef std::unordered_map<int, std::string> C;
C c; C c;
C::size_type i = c.bucket(3); (void) c.bucket(3);
assert(false); assert(false);
} }
#endif #endif

View File

@@ -74,7 +74,7 @@ int main(int, char**)
{ {
typedef std::unordered_map<int, std::string> C; typedef std::unordered_map<int, std::string> C;
C c; C c;
C::size_type i = c.bucket_size(3); (void) c.bucket_size(3);
assert(false); assert(false);
} }
#endif #endif

View File

@@ -70,7 +70,7 @@ int main(int, char**)
{ {
typedef std::unordered_multimap<int, std::string> C; typedef std::unordered_multimap<int, std::string> C;
C c; C c;
C::size_type i = c.bucket(3); (void) c.bucket(3);
assert(false); assert(false);
} }
#endif #endif

View File

@@ -78,7 +78,7 @@ int main(int, char**)
{ {
typedef std::unordered_multimap<int, std::string> C; typedef std::unordered_multimap<int, std::string> C;
C c; C c;
C::size_type i = c.bucket_size(3); (void) c.bucket_size(3);
assert(false); assert(false);
} }
#endif #endif

View File

@@ -69,7 +69,7 @@ int main(int, char**)
{ {
typedef std::unordered_multiset<int> C; typedef std::unordered_multiset<int> C;
C c; C c;
C::size_type i = c.bucket(3); (void) c.bucket(3);
assert(false); assert(false);
} }
#endif #endif

View File

@@ -77,7 +77,7 @@ int main(int, char**)
{ {
typedef std::unordered_multiset<int> C; typedef std::unordered_multiset<int> C;
C c; C c;
C::size_type i = c.bucket_size(3); (void) c.bucket_size(3);
assert(false); assert(false);
} }
#endif #endif

View File

@@ -37,7 +37,7 @@ int main(int, char**)
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
typedef int T; typedef int T;
typedef std::unordered_multiset<T, min_allocator<T>> C; typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1); C c(1);
C::iterator i = c.begin(); C::iterator i = c.begin();
++i; ++i;

View File

@@ -29,16 +29,16 @@ int main(int, char**)
typedef std::unordered_multiset<T> C; typedef std::unordered_multiset<T> C;
C c(1); C c(1);
C::iterator i = c.end(); C::iterator i = c.end();
T j = *i; (void) *i;
assert(false); assert(false);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
typedef int T; typedef int T;
typedef std::unordered_multiset<T, min_allocator<T>> C; typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1); C c(1);
C::iterator i = c.end(); C::iterator i = c.end();
T j = *i; (void) *i;
assert(false); assert(false);
} }
#endif #endif

View File

@@ -36,7 +36,7 @@ int main(int, char**)
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
typedef int T; typedef int T;
typedef std::unordered_multiset<T, min_allocator<T>> C; typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1); C c(1);
C::local_iterator i = c.begin(0); C::local_iterator i = c.begin(0);
++i; ++i;

View File

@@ -29,16 +29,16 @@ int main(int, char**)
typedef std::unordered_multiset<T> C; typedef std::unordered_multiset<T> C;
C c(1); C c(1);
C::local_iterator i = c.end(0); C::local_iterator i = c.end(0);
T j = *i; (void) *i;
assert(false); assert(false);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
typedef int T; typedef int T;
typedef std::unordered_multiset<T, min_allocator<T>> C; typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1); C c(1);
C::local_iterator i = c.end(0); C::local_iterator i = c.end(0);
T j = *i; (void) *i;
assert(false); assert(false);
} }
#endif #endif

View File

@@ -68,7 +68,7 @@ int main(int, char**)
{ {
typedef std::unordered_set<int> C; typedef std::unordered_set<int> C;
C c; C c;
C::size_type i = c.bucket(3); (void) c.bucket(3);
assert(false); assert(false);
} }
#endif #endif

View File

@@ -72,7 +72,7 @@ int main(int, char**)
{ {
typedef std::unordered_set<int> C; typedef std::unordered_set<int> C;
C c; C c;
C::size_type i = c.bucket_size(3); (void) c.bucket_size(3);
assert(false); assert(false);
} }
#endif #endif

View File

@@ -37,7 +37,7 @@ int main(int, char**)
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
typedef int T; typedef int T;
typedef std::unordered_set<T, min_allocator<T>> C; typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1); C c(1);
C::iterator i = c.begin(); C::iterator i = c.begin();
++i; ++i;

View File

@@ -29,16 +29,16 @@ int main(int, char**)
typedef std::unordered_set<T> C; typedef std::unordered_set<T> C;
C c(1); C c(1);
C::iterator i = c.end(); C::iterator i = c.end();
T j = *i; (void) *i;
assert(false); assert(false);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
typedef int T; typedef int T;
typedef std::unordered_set<T, min_allocator<T>> C; typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1); C c(1);
C::iterator i = c.end(); C::iterator i = c.end();
T j = *i; (void) *i;
assert(false); assert(false);
} }
#endif #endif

View File

@@ -36,7 +36,7 @@ int main(int, char**)
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
typedef int T; typedef int T;
typedef std::unordered_set<T, min_allocator<T>> C; typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1); C c(1);
C::local_iterator i = c.begin(0); C::local_iterator i = c.begin(0);
++i; ++i;

View File

@@ -29,16 +29,17 @@ int main(int, char**)
typedef std::unordered_set<T> C; typedef std::unordered_set<T> C;
C c(1); C c(1);
C::local_iterator i = c.end(0); C::local_iterator i = c.end(0);
T j = *i; (void) *i;
assert(false); assert(false);
} }
#if TEST_STD_VER >= 11 #if TEST_STD_VER >= 11
{ {
typedef int T; typedef int T;
typedef std::unordered_set<T, min_allocator<T>> C; typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
C c(1); C c(1);
C::local_iterator i = c.end(0); C::local_iterator i = c.end(0);
T j = *i; (void) *i;
assert(false); assert(false);
} }
#endif #endif

View File

@@ -30,12 +30,11 @@ int main(int, char**)
typedef std::unordered_set<Emplaceable> C; typedef std::unordered_set<Emplaceable> C;
typedef C::iterator R; typedef C::iterator R;
C c; C c;
C::const_iterator e = c.end(); R r = c.emplace_hint(c.end());
R r = c.emplace_hint(e);
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == Emplaceable()); assert(*r == Emplaceable());
r = c.emplace_hint(e, Emplaceable(5, 6)); r = c.emplace_hint(c.end(), Emplaceable(5, 6));
assert(c.size() == 2); assert(c.size() == 2);
assert(*r == Emplaceable(5, 6)); assert(*r == Emplaceable(5, 6));
@@ -48,12 +47,11 @@ int main(int, char**)
std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C; std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
typedef C::iterator R; typedef C::iterator R;
C c; C c;
C::const_iterator e = c.end(); R r = c.emplace_hint(c.end());
R r = c.emplace_hint(e);
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == Emplaceable()); assert(*r == Emplaceable());
r = c.emplace_hint(e, Emplaceable(5, 6)); r = c.emplace_hint(c.end(), Emplaceable(5, 6));
assert(c.size() == 2); assert(c.size() == 2);
assert(*r == Emplaceable(5, 6)); assert(*r == Emplaceable(5, 6));

View File

@@ -28,8 +28,7 @@ int main(int, char**)
typedef C::iterator R; typedef C::iterator R;
typedef double P; typedef double P;
C c; C c;
C::const_iterator e = c.end(); R r = c.insert(c.end(), P(3.5));
R r = c.insert(e, P(3.5));
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == 3.5); assert(*r == 3.5);
@@ -37,11 +36,11 @@ int main(int, char**)
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == 3.5); assert(*r == 3.5);
r = c.insert(e, P(4.5)); r = c.insert(c.end(), P(4.5));
assert(c.size() == 2); assert(c.size() == 2);
assert(*r == 4.5); assert(*r == 4.5);
r = c.insert(e, P(5.5)); r = c.insert(c.end(), P(5.5));
assert(c.size() == 3); assert(c.size() == 3);
assert(*r == 5.5); assert(*r == 5.5);
} }
@@ -51,8 +50,7 @@ int main(int, char**)
typedef C::iterator R; typedef C::iterator R;
typedef MoveOnly P; typedef MoveOnly P;
C c; C c;
C::const_iterator e = c.end(); R r = c.insert(c.end(), P(3));
R r = c.insert(e, P(3));
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == 3); assert(*r == 3);
@@ -60,11 +58,11 @@ int main(int, char**)
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == 3); assert(*r == 3);
r = c.insert(e, P(4)); r = c.insert(c.end(), P(4));
assert(c.size() == 2); assert(c.size() == 2);
assert(*r == 4); assert(*r == 4);
r = c.insert(e, P(5)); r = c.insert(c.end(), P(5));
assert(c.size() == 3); assert(c.size() == 3);
assert(*r == 5); assert(*r == 5);
} }
@@ -74,8 +72,7 @@ int main(int, char**)
typedef C::iterator R; typedef C::iterator R;
typedef double P; typedef double P;
C c; C c;
C::const_iterator e = c.end(); R r = c.insert(c.end(), P(3.5));
R r = c.insert(e, P(3.5));
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == 3.5); assert(*r == 3.5);
@@ -83,11 +80,11 @@ int main(int, char**)
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == 3.5); assert(*r == 3.5);
r = c.insert(e, P(4.5)); r = c.insert(c.end(), P(4.5));
assert(c.size() == 2); assert(c.size() == 2);
assert(*r == 4.5); assert(*r == 4.5);
r = c.insert(e, P(5.5)); r = c.insert(c.end(), P(5.5));
assert(c.size() == 3); assert(c.size() == 3);
assert(*r == 5.5); assert(*r == 5.5);
} }
@@ -97,8 +94,7 @@ int main(int, char**)
typedef C::iterator R; typedef C::iterator R;
typedef MoveOnly P; typedef MoveOnly P;
C c; C c;
C::const_iterator e = c.end(); R r = c.insert(c.end(), P(3));
R r = c.insert(e, P(3));
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == 3); assert(*r == 3);
@@ -106,11 +102,11 @@ int main(int, char**)
assert(c.size() == 1); assert(c.size() == 1);
assert(*r == 3); assert(*r == 3);
r = c.insert(e, P(4)); r = c.insert(c.end(), P(4));
assert(c.size() == 2); assert(c.size() == 2);
assert(*r == 4); assert(*r == 4);
r = c.insert(e, P(5)); r = c.insert(c.end(), P(5));
assert(c.size() == 3); assert(c.size() == 3);
assert(*r == 5); assert(*r == 5);
} }