libstdc++: Add _GLIBCXX_DEBUG checks on unordered container
local_iterator
Some _GLIBCXX_DEBUG checks in include/debug/safe_local_iterator.h
were not properly
tested.
Fix several tests not testing the container corresponding to their
location in the
testsuite location.
libstdc++-v3/ChangeLog:
* testsuite/util/debug/unordered_checks.h
(invalid_local_iterator_arrow_operator): New test function.
(invalid_local_iterator_copy_instantiation): New test function.
(invalid_local_iterator_move_instantiation): New test function.
(invalid_local_iterator_copy_assignment): New test function.
(invalid_local_iterator_move_assignment): New test function.
(invalid_local_iterator_const_conversion): New test function.
*
testsuite/23_containers/unordered_map/debug/invalid_local_iterator_arrow_operator_neg.cc:
New test case.
*
testsuite/23_containers/unordered_map/debug/invalid_local_iterator_const_conversion_neg.cc:
New test case.
*
testsuite/23_containers/unordered_map/debug/invalid_local_iterator_copy_assignment_neg.cc:
New test case.
*
testsuite/23_containers/unordered_map/debug/invalid_local_iterator_copy_instantiation_neg.cc:
New test case.
*
testsuite/23_containers/unordered_map/debug/invalid_local_iterator_move_assignment_neg.cc:
New test case.
*
testsuite/23_containers/unordered_map/debug/invalid_local_iterator_move_instantiation_neg.cc:
New test case.
*
testsuite/23_containers/unordered_map/debug/max_load_factor_neg.cc: Test
unordered_map.
*
testsuite/23_containers/unordered_multimap/debug/begin2_neg.cc: Test
unordered_multimap.
*
testsuite/23_containers/unordered_multimap/debug/bucket_size_neg.cc:
Likewise.
*
testsuite/23_containers/unordered_multimap/debug/cbegin_neg.cc: Likewise.
*
testsuite/23_containers/unordered_multimap/debug/cend_neg.cc: Likewise.
*
testsuite/23_containers/unordered_multimap/debug/end1_neg.cc: Likewise.
*
testsuite/23_containers/unordered_multimap/debug/end2_neg.cc: Likewise.
*
testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_arrow_operator_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_const_conversion_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_copy_assignment_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_copy_instantiation_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_move_assignment_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_move_instantiation_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multimap/debug/max_load_factor_neg.cc:
Test unordered_multimap.
*
testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_arrow_operator_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_const_conversion_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_copy_assignment_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_copy_instantiation_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_move_assignment_neg.cc:
New test case.
*
testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_move_instantiation_neg.cc:
New test case.
*
testsuite/23_containers/unordered_set/debug/invalid_local_iterator_arrow_operator_neg.cc:
New test case.
*
testsuite/23_containers/unordered_set/debug/invalid_local_iterator_const_conversion_neg.cc:
New test case.
*
testsuite/23_containers/unordered_set/debug/invalid_local_iterator_copy_assignment_neg.cc:
New test case.
*
testsuite/23_containers/unordered_set/debug/invalid_local_iterator_copy_instantiation_neg.cc:
New test case.
*
testsuite/23_containers/unordered_set/debug/invalid_local_iterator_move_assignment_neg.cc:
New test case.
*
testsuite/23_containers/unordered_set/debug/invalid_local_iterator_move_instantiation_neg.cc:
New test case.
Tested under Linux x86_64, ok to commit ?
François
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_arrow_operator_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_arrow_operator_neg.cc
new file mode 100644
index 00000000000..09870a76b99
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_arrow_operator_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_arrow_operator
+ <std::unordered_map<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_const_conversion_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_const_conversion_neg.cc
new file mode 100644
index 00000000000..7bfe3a8d76f
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_const_conversion_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_const_conversion
+ <std::unordered_map<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_copy_assignment_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_copy_assignment_neg.cc
new file mode 100644
index 00000000000..d3b671b14cf
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_copy_assignment_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_copy_assignment
+ <std::unordered_map<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_copy_instantiation_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_copy_instantiation_neg.cc
new file mode 100644
index 00000000000..aec912e4bb5
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_copy_instantiation_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_copy_instantiation
+ <std::unordered_map<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_move_assignment_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_move_assignment_neg.cc
new file mode 100644
index 00000000000..8d2ed6bf215
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_move_assignment_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_move_assignment
+ <std::unordered_map<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_move_instantiation_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_move_instantiation_neg.cc
new file mode 100644
index 00000000000..ee9ec5f6fbe
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/invalid_local_iterator_move_instantiation_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_move_instantiation
+ <std::unordered_map<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/max_load_factor_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/max_load_factor_neg.cc
index 7fbc453f045..25967980dc9 100644
---
a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/max_load_factor_neg.cc
+++
b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/max_load_factor_neg.cc
@@ -22,7 +22,7 @@
void test01()
{
- std::unordered_multimap<int, int> um;
+ std::unordered_map<int, int> um;
um.max_load_factor(-1.0f);
}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/begin2_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/begin2_neg.cc
index ff787cf6f4a..b2d67fbaa00 100644
---
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/begin2_neg.cc
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/begin2_neg.cc
@@ -22,8 +22,8 @@
void test01()
{
- std::unordered_map<int, int> um;
- const std::unordered_map<int, int>& cum = um;
+ std::unordered_multimap<int, int> um;
+ const std::unordered_multimap<int, int>& cum = um;
cum.begin(um.bucket_count());
}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/bucket_size_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/bucket_size_neg.cc
index b5ddb18af8f..4d5cb846a64 100644
---
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/bucket_size_neg.cc
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/bucket_size_neg.cc
@@ -22,7 +22,7 @@
void test01()
{
- std::unordered_map<int, int> um;
+ std::unordered_multimap<int, int> um;
um.bucket_size(um.bucket_count());
}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/cbegin_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/cbegin_neg.cc
index 5ba1da56aa5..654d4091fb3 100644
---
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/cbegin_neg.cc
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/cbegin_neg.cc
@@ -22,7 +22,7 @@
void test01()
{
- std::unordered_map<int, int> um;
+ std::unordered_multimap<int, int> um;
um.cbegin(um.bucket_count());
}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/cend_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/cend_neg.cc
index 031be37e0e7..f7149d40f51 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/cend_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/cend_neg.cc
@@ -22,7 +22,7 @@
void test01()
{
- std::unordered_map<int, int> um;
+ std::unordered_multimap<int, int> um;
um.cend(um.bucket_count());
}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/end1_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/end1_neg.cc
index d412fcf9e4e..fd0f981b4e4 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/end1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/end1_neg.cc
@@ -22,7 +22,7 @@
void test01()
{
- std::unordered_map<int, int> um;
+ std::unordered_multimap<int, int> um;
um.end(um.bucket_count());
}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/end2_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/end2_neg.cc
index 0115351df94..0c3f86c4359 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/end2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/end2_neg.cc
@@ -22,8 +22,8 @@
void test01()
{
- std::unordered_map<int, int> um;
- const std::unordered_map<int, int>& cum = um;
+ std::unordered_multimap<int, int> um;
+ const std::unordered_multimap<int, int>& cum = um;
cum.end(um.bucket_count());
}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_arrow_operator_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_arrow_operator_neg.cc
new file mode 100644
index 00000000000..8b2302010d9
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_arrow_operator_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_arrow_operator
+ <std::unordered_multimap<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_const_conversion_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_const_conversion_neg.cc
new file mode 100644
index 00000000000..62c0280c201
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_const_conversion_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_const_conversion
+ <std::unordered_multimap<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_copy_assignment_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_copy_assignment_neg.cc
new file mode 100644
index 00000000000..9ac5b35045a
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_copy_assignment_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_copy_assignment
+ <std::unordered_multimap<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_copy_instantiation_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_copy_instantiation_neg.cc
new file mode 100644
index 00000000000..5a34d0ff31c
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_copy_instantiation_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_copy_instantiation
+ <std::unordered_multimap<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_move_assignment_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_move_assignment_neg.cc
new file mode 100644
index 00000000000..32c847c9b2f
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_move_assignment_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_move_assignment
+ <std::unordered_multimap<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_move_instantiation_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_move_instantiation_neg.cc
new file mode 100644
index 00000000000..9bbe039b746
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/invalid_local_iterator_move_instantiation_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_map>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_move_instantiation
+ <std::unordered_multimap<int, int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/max_load_factor_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/max_load_factor_neg.cc
index 25967980dc9..7fbc453f045 100644
---
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/max_load_factor_neg.cc
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/debug/max_load_factor_neg.cc
@@ -22,7 +22,7 @@
void test01()
{
- std::unordered_map<int, int> um;
+ std::unordered_multimap<int, int> um;
um.max_load_factor(-1.0f);
}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_arrow_operator_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_arrow_operator_neg.cc
new file mode 100644
index 00000000000..1677b202263
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_arrow_operator_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_arrow_operator
+ <std::unordered_multiset<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_const_conversion_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_const_conversion_neg.cc
new file mode 100644
index 00000000000..0d64a4129cd
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_const_conversion_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_const_conversion
+ <std::unordered_multiset<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_copy_assignment_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_copy_assignment_neg.cc
new file mode 100644
index 00000000000..b0d7b9f4798
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_copy_assignment_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_copy_assignment
+ <std::unordered_multiset<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_copy_instantiation_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_copy_instantiation_neg.cc
new file mode 100644
index 00000000000..0d031f4c882
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_copy_instantiation_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_copy_instantiation
+ <std::unordered_multiset<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_move_assignment_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_move_assignment_neg.cc
new file mode 100644
index 00000000000..b25fedc6b2e
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_move_assignment_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_move_assignment
+ <std::unordered_multiset<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_move_instantiation_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_move_instantiation_neg.cc
new file mode 100644
index 00000000000..dd6172875be
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/debug/invalid_local_iterator_move_instantiation_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_move_instantiation
+ <std::unordered_multiset<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_arrow_operator_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_arrow_operator_neg.cc
new file mode 100644
index 00000000000..f62ed6bd453
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_arrow_operator_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_arrow_operator
+ <std::unordered_set<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_const_conversion_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_const_conversion_neg.cc
new file mode 100644
index 00000000000..839f9aec094
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_const_conversion_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_const_conversion
+ <std::unordered_set<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_copy_assignment_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_copy_assignment_neg.cc
new file mode 100644
index 00000000000..377019f8a35
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_copy_assignment_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_copy_assignment
+ <std::unordered_set<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_copy_instantiation_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_copy_instantiation_neg.cc
new file mode 100644
index 00000000000..bda88f4a238
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_copy_instantiation_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_copy_instantiation
+ <std::unordered_set<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_move_assignment_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_move_assignment_neg.cc
new file mode 100644
index 00000000000..d16a154de00
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_move_assignment_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_move_assignment
+ <std::unordered_set<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git
a/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_move_instantiation_neg.cc
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_move_instantiation_neg.cc
new file mode 100644
index 00000000000..f51f069a6c6
--- /dev/null
+++
b/libstdc++-v3/testsuite/23_containers/unordered_set/debug/invalid_local_iterator_move_instantiation_neg.cc
@@ -0,0 +1,17 @@
+// { dg-do run { target c++11 xfail *-*-* } }
+// { dg-require-debug-mode "" }
+
+#include <unordered_set>
+#include <debug/unordered_checks.h>
+
+void test01()
+{
+ __gnu_test::invalid_local_iterator_move_instantiation
+ <std::unordered_set<int>>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/util/debug/unordered_checks.h
b/libstdc++-v3/testsuite/util/debug/unordered_checks.h
index d01ee827c48..f7979190861 100644
--- a/libstdc++-v3/testsuite/util/debug/unordered_checks.h
+++ b/libstdc++-v3/testsuite/util/debug/unordered_checks.h
@@ -125,6 +125,162 @@ namespace __gnu_test
VERIFY( *it == val );
}
+ template<typename _Tp>
+ void invalid_local_iterator_arrow_operator()
+ {
+ typedef _Tp cont_type;
+ typedef typename cont_type::value_type cont_val_type;
+ typedef typename CopyableValueType<cont_val_type>::value_type val_type;
+ generate_unique<val_type> gu;
+
+ cont_type c;
+ for (size_t i = 0; i != 5; ++i)
+ c.insert(gu.build());
+
+ typename cont_type::local_iterator it;
+ for (size_t i = 0; i != c.bucket_count(); ++i)
+ {
+ it = c.begin(i);
+ if (it != c.end(i))
+ break;
+ }
+ cont_val_type val = *it;
+ c.clear();
+ VERIFY( *it.operator->() == val );
+ }
+
+ template<typename _Tp>
+ void invalid_local_iterator_copy_instantiation()
+ {
+ typedef _Tp cont_type;
+ typedef typename cont_type::value_type cont_val_type;
+ typedef typename CopyableValueType<cont_val_type>::value_type val_type;
+ generate_unique<val_type> gu;
+
+ cont_type c;
+ for (size_t i = 0; i != 5; ++i)
+ c.insert(gu.build());
+
+ typename cont_type::local_iterator it;
+ for (size_t i = 0; i != c.bucket_count(); ++i)
+ {
+ it = c.begin(i);
+ if (it != c.end(i))
+ break;
+ }
+
+ cont_val_type val = *it;
+ c.clear();
+ typename cont_type::local_iterator lit(it);
+ VERIFY( *lit == val );
+ }
+
+ template<typename _Tp>
+ void invalid_local_iterator_move_instantiation()
+ {
+ typedef _Tp cont_type;
+ typedef typename cont_type::value_type cont_val_type;
+ typedef typename CopyableValueType<cont_val_type>::value_type val_type;
+ generate_unique<val_type> gu;
+
+ cont_type c;
+ for (size_t i = 0; i != 5; ++i)
+ c.insert(gu.build());
+
+ typename cont_type::local_iterator it;
+ for (size_t i = 0; i != c.bucket_count(); ++i)
+ {
+ it = c.begin(i);
+ if (it != c.end(i))
+ break;
+ }
+
+ cont_val_type val = *it;
+ c.clear();
+ typename cont_type::local_iterator lit(std::move(it));
+ VERIFY( *lit == val );
+ }
+
+ template<typename _Tp>
+ void invalid_local_iterator_copy_assignment()
+ {
+ typedef _Tp cont_type;
+ typedef typename cont_type::value_type cont_val_type;
+ typedef typename CopyableValueType<cont_val_type>::value_type val_type;
+ generate_unique<val_type> gu;
+
+ cont_type c;
+ for (size_t i = 0; i != 5; ++i)
+ c.insert(gu.build());
+
+ typename cont_type::local_iterator it;
+ for (size_t i = 0; i != c.bucket_count(); ++i)
+ {
+ it = c.begin(i);
+ if (it != c.end(i))
+ break;
+ }
+
+ cont_val_type val = *it;
+ c.clear();
+ typename cont_type::local_iterator lit;
+ lit = it;
+ VERIFY( *lit == val );
+ }
+
+ template<typename _Tp>
+ void invalid_local_iterator_move_assignment()
+ {
+ typedef _Tp cont_type;
+ typedef typename cont_type::value_type cont_val_type;
+ typedef typename CopyableValueType<cont_val_type>::value_type val_type;
+ generate_unique<val_type> gu;
+
+ cont_type c;
+ for (size_t i = 0; i != 5; ++i)
+ c.insert(gu.build());
+
+ typename cont_type::local_iterator it;
+ for (size_t i = 0; i != c.bucket_count(); ++i)
+ {
+ it = c.begin(i);
+ if (it != c.end(i))
+ break;
+ }
+
+ cont_val_type val = *it;
+ c.clear();
+ typename cont_type::local_iterator lit;
+ lit = std::move(it);
+ VERIFY( *lit == val );
+ }
+
+ template<typename _Tp>
+ void invalid_local_iterator_const_conversion()
+ {
+ typedef _Tp cont_type;
+ typedef typename cont_type::value_type cont_val_type;
+ typedef typename CopyableValueType<cont_val_type>::value_type val_type;
+ generate_unique<val_type> gu;
+
+ cont_type c;
+ for (size_t i = 0; i != 5; ++i)
+ c.insert(gu.build());
+
+ typename cont_type::local_iterator it;
+ for (size_t i = 0; i != c.bucket_count(); ++i)
+ {
+ it = c.begin(i);
+ if (it != c.end(i))
+ break;
+ }
+
+ cont_val_type val = *it;
+ c.clear();
+ typename cont_type::const_local_iterator clit(it);
+ VERIFY( *clit == val );
+ }
+
template<typename _Tp>
void invalid_local_iterator_pre_increment()
{