summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/unordered_map
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/23_containers/unordered_map
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/unordered_map')
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/cons/moveable.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct1_neg.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct2_neg.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct3_neg.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct4_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert1_neg.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert2_neg.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert3_neg.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert4_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/dr761.cc79
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc129
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/erase/24061-map.cc105
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/erase/51142.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/hash_policy/dr1189.cc48
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/init-list.cc54
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/24061-map.cc60
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc56
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax_move.cc59
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_range.cc97
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single.cc72
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-1.cc76
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-2.cc79
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/operators/1.cc169
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/profile/hash_map.cc22
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/profile/unordered.cc47
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_container.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_mode.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/basic.cc42
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/generation_prohibited.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/propagation_consistent.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/1.cc23
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/2.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc24
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/4.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/typedefs.cc25
38 files changed, 1916 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/moveable.cc
new file mode 100644
index 000000000..ab73be1e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/moveable.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on map (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <unordered_map>
+#include <utility>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unordered_map<int, int> a,b;
+ a[2]=0;
+ b[1]=0;
+ b = std::move(a);
+ VERIFY( b.find(2) != b.end() && a.find(1) == a.end() );
+
+ std::unordered_map<int, int> c(std::move(b));
+ VERIFY( c.find(2) != c.end() );
+ VERIFY( b.find(2) == b.end() );
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct1_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct1_neg.cc
new file mode 100644
index 000000000..31961f7ce
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct1_neg.cc
@@ -0,0 +1,34 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <unordered_map>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct1<std::unordered_map<int, int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct2_neg.cc
new file mode 100644
index 000000000..560651a46
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct2_neg.cc
@@ -0,0 +1,34 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <unordered_map>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct2<std::unordered_map<int, int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct3_neg.cc
new file mode 100644
index 000000000..7d57272f1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct3_neg.cc
@@ -0,0 +1,34 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <unordered_map>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct3<std::unordered_map<int, int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct4_neg.cc
new file mode 100644
index 000000000..e37cab21a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/construct4_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <debug/unordered_map>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct1<__gnu_debug::unordered_map<int, int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert1_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert1_neg.cc
new file mode 100644
index 000000000..f3d06bf74
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert1_neg.cc
@@ -0,0 +1,34 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <unordered_map>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert1<std::unordered_map<int, int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert2_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert2_neg.cc
new file mode 100644
index 000000000..09d55e190
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert2_neg.cc
@@ -0,0 +1,34 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <unordered_map>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert2<std::unordered_map<int, int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert3_neg.cc
new file mode 100644
index 000000000..41af75917
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert3_neg.cc
@@ -0,0 +1,34 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <unordered_map>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert3<std::unordered_map<int, int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert4_neg.cc
new file mode 100644
index 000000000..6239431bb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/debug/insert4_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <debug/unordered_map>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert1<__gnu_debug::unordered_map<int, int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/dr761.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/dr761.cc
new file mode 100644
index 000000000..82b67f4ee
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/dr761.cc
@@ -0,0 +1,79 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-05-22 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// DR 761. unordered_map needs an at() member function.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::unordered_map<int, double> map_type;
+
+ {
+ map_type m;
+ m[0] = 1.5;
+
+ double& rd = m.at(0);
+ VERIFY( rd == 1.5 );
+ try
+ {
+ m.at(1);
+ }
+ catch(std::out_of_range& obj)
+ {
+ // Expected.
+ }
+ catch(...)
+ {
+ // Failed.
+ throw;
+ }
+ }
+
+ {
+ map_type m;
+ m[1] = 2.5;
+ const map_type cm(m);
+
+ const double& crd = cm.at(1);
+ VERIFY( crd == 2.5 );
+ try
+ {
+ cm.at(0);
+ }
+ catch(std::out_of_range& obj)
+ {
+ // Expected.
+ }
+ catch(...)
+ {
+ // Failed.
+ throw;
+ }
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc
new file mode 100644
index 000000000..f9b74e08c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/erase/1.cc
@@ -0,0 +1,129 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<std::string, int> Map;
+ typedef Map::iterator iterator;
+ typedef Map::const_iterator const_iterator;
+ typedef Map::value_type value_type;
+
+ Map m1;
+
+ m1.insert(value_type("because to why", 1));
+ m1.insert(value_type("the stockholm syndrome", 2));
+ m1.insert(value_type("a cereous night", 3));
+ m1.insert(value_type("eeilo", 4));
+ m1.insert(value_type("protean", 5));
+ m1.insert(value_type("the way you are when", 6));
+ m1.insert(value_type("tillsammans", 7));
+ m1.insert(value_type("umbra/penumbra", 8));
+ m1.insert(value_type("belonging (no longer mix)", 9));
+ m1.insert(value_type("one line behind", 10));
+ VERIFY( m1.size() == 10 );
+
+ VERIFY( m1.erase("eeilo") == 1 );
+ VERIFY( m1.size() == 9 );
+ iterator it1 = m1.find("eeilo");
+ VERIFY( it1 == m1.end() );
+
+ VERIFY( m1.erase("tillsammans") == 1 );
+ VERIFY( m1.size() == 8 );
+ iterator it2 = m1.find("tillsammans");
+ VERIFY( it2 == m1.end() );
+
+ // Must work (see DR 526)
+ iterator it3 = m1.find("belonging (no longer mix)");
+ VERIFY( it3 != m1.end() );
+ VERIFY( m1.erase(it3->first) == 1 );
+ VERIFY( m1.size() == 7 );
+ it3 = m1.find("belonging (no longer mix)");
+ VERIFY( it3 == m1.end() );
+
+ VERIFY( !m1.erase("abra") );
+ VERIFY( m1.size() == 7 );
+
+ VERIFY( !m1.erase("eeilo") );
+ VERIFY( m1.size() == 7 );
+
+ VERIFY( m1.erase("because to why") == 1 );
+ VERIFY( m1.size() == 6 );
+ iterator it4 = m1.find("because to why");
+ VERIFY( it4 == m1.end() );
+
+ iterator it5 = m1.find("umbra/penumbra");
+ iterator it6 = m1.find("one line behind");
+ VERIFY( it5 != m1.end() );
+ VERIFY( it6 != m1.end() );
+
+ VERIFY( m1.find("the stockholm syndrome") != m1.end() );
+ VERIFY( m1.find("a cereous night") != m1.end() );
+ VERIFY( m1.find("the way you are when") != m1.end() );
+ VERIFY( m1.find("a cereous night") != m1.end() );
+
+ VERIFY( m1.erase(it5->first) == 1 );
+ VERIFY( m1.size() == 5 );
+ it5 = m1.find("umbra/penumbra");
+ VERIFY( it5 == m1.end() );
+
+ VERIFY( m1.erase(it6->first) == 1 );
+ VERIFY( m1.size() == 4 );
+ it6 = m1.find("one line behind");
+ VERIFY( it6 == m1.end() );
+
+ iterator it7 = m1.begin();
+ iterator it8 = it7;
+ ++it8;
+ iterator it9 = it8;
+ ++it9;
+
+ VERIFY( m1.erase(it8->first) == 1 );
+ VERIFY( m1.size() == 3 );
+ VERIFY( ++it7 == it9 );
+
+ iterator it10 = it9;
+ ++it10;
+ iterator it11 = it10;
+
+ VERIFY( m1.erase(it9->first) == 1 );
+ VERIFY( m1.size() == 2 );
+ VERIFY( ++it10 == m1.end() );
+
+ VERIFY( m1.erase(m1.begin()) != m1.end() );
+ VERIFY( m1.size() == 1 );
+ VERIFY( m1.begin() == it11 );
+
+ VERIFY( m1.erase(m1.begin()->first) == 1 );
+ VERIFY( m1.size() == 0 );
+ VERIFY( m1.begin() == m1.end() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/erase/24061-map.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/erase/24061-map.cc
new file mode 100644
index 000000000..87ab474a8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/erase/24061-map.cc
@@ -0,0 +1,105 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<std::string, int> Map;
+ typedef Map::iterator iterator;
+ typedef Map::const_iterator const_iterator;
+ typedef Map::value_type value_type;
+
+ Map m1;
+
+ m1.insert(value_type("all the love in the world", 1));
+ m1.insert(value_type("you know what you are?", 2));
+ m1.insert(value_type("the collector", 3));
+ m1.insert(value_type("the hand that feeds", 4));
+ m1.insert(value_type("love is not enough", 5));
+ m1.insert(value_type("every day is exactly the same", 6));
+ m1.insert(value_type("with teeth", 7));
+ m1.insert(value_type("only", 8));
+ m1.insert(value_type("getting smaller", 9));
+ m1.insert(value_type("sunspots", 10));
+ VERIFY( m1.size() == 10 );
+
+ iterator it1 = m1.begin();
+ ++it1;
+ iterator it2 = it1;
+ ++it2;
+ iterator it3 = m1.erase(it1);
+ VERIFY( m1.size() == 9 );
+ VERIFY( it3 == it2 );
+ VERIFY( *it3 == *it2 );
+
+ iterator it4 = m1.begin();
+ ++it4;
+ ++it4;
+ ++it4;
+ iterator it5 = it4;
+ ++it5;
+ ++it5;
+ iterator it6 = m1.erase(it4, it5);
+ VERIFY( m1.size() == 7 );
+ VERIFY( it6 == it5 );
+ VERIFY( *it6 == *it5 );
+
+ const_iterator it7 = m1.begin();
+ ++it7;
+ ++it7;
+ ++it7;
+ const_iterator it8 = it7;
+ ++it8;
+ const_iterator it9 = m1.erase(it7);
+ VERIFY( m1.size() == 6 );
+ VERIFY( it9 == it8 );
+ VERIFY( *it9 == *it8 );
+
+ const_iterator it10 = m1.begin();
+ ++it10;
+ const_iterator it11 = it10;
+ ++it11;
+ ++it11;
+ ++it11;
+ ++it11;
+ const_iterator it12 = m1.erase(it10, it11);
+ VERIFY( m1.size() == 2 );
+ VERIFY( it12 == it11 );
+ VERIFY( *it12 == *it11 );
+ VERIFY( ++it12 == m1.end() );
+
+ iterator it13 = m1.erase(m1.begin(), m1.end());
+ VERIFY( m1.size() == 0 );
+ VERIFY( it13 == it12 );
+ VERIFY( it13 == m1.begin() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/erase/51142.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/erase/51142.cc
new file mode 100644
index 000000000..eab637df2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/erase/51142.cc
@@ -0,0 +1,38 @@
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+#include <unordered_map>
+
+struct X
+{
+ template<typename T>
+ X(T&) {}
+};
+
+bool operator==(const X&, const X&) { return false; }
+
+// LWG 2059.
+void erasor(std::unordered_map<X, int>& s, X x)
+{
+ std::unordered_map<X, int>::iterator it = s.find(x);
+ if (it != s.end())
+ s.erase(it);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/hash_policy/dr1189.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/hash_policy/dr1189.cc
new file mode 100644
index 000000000..f89d5f199
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/hash_policy/dr1189.cc
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+// 2010-03-10 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+// DR 1189. Awkward interface for changing the number of buckets
+// in an unordered associative container
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unordered_map<int, double> m1;
+ m1.reserve(10);
+ VERIFY( m1.bucket_count() >= 10 );
+
+ m1.reserve(100);
+ VERIFY( m1.bucket_count() >= 100 );
+
+ std::unordered_map<int, double> m2(100);
+ VERIFY( m2.bucket_count() >= 100 );
+
+ m2.reserve(1000);
+ VERIFY( m2.bucket_count() >= 1000 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/init-list.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/init-list.cc
new file mode 100644
index 000000000..262fa0eb9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/init-list.cc
@@ -0,0 +1,54 @@
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+// { dg-options "-std=gnu++0x" }
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ unordered_map<int,double> m({ { 1, 1.0 }, { 2, 2.0 }, { 42, 237.0 } });
+ VERIFY(m.size() == 3);
+ VERIFY(m[1] == 1.0);
+ VERIFY(m[2] == 2.0);
+ VERIFY(m[42] == 237.0);
+
+ m = { {5, 55.0}, { 6, 66.0 } };
+ VERIFY(m.size() == 2);
+ VERIFY(m[5] == 55.0);
+ VERIFY(m[6] == 66.0);
+
+ m.insert({ { 7, 77.0 }, { 8, 88.0 } });
+ VERIFY(m.size() == 4);
+ VERIFY(m[5] == 55.0);
+ VERIFY(m[6] == 66.0);
+ VERIFY(m[7] == 77.0);
+ VERIFY(m[8] == 88.0);
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/24061-map.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/24061-map.cc
new file mode 100644
index 000000000..d9a187870
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/24061-map.cc
@@ -0,0 +1,60 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/24061
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<std::string, int> Map;
+ typedef Map::iterator iterator;
+ typedef Map::const_iterator const_iterator;
+ typedef Map::value_type value_type;
+
+ Map m1;
+
+ iterator it1 = m1.insert(m1.begin(),
+ value_type("all the love in the world", 1));
+ VERIFY( m1.size() == 1 );
+ VERIFY( *it1 == value_type("all the love in the world", 1) );
+
+ const_iterator cit1(it1);
+ const_iterator cit2 = m1.insert(cit1,
+ value_type("you know what you are?", 2));
+ VERIFY( m1.size() == 2 );
+ VERIFY( cit2 != cit1 );
+ VERIFY( *cit2 == value_type("you know what you are?", 2) );
+
+ iterator it2 = m1.insert(it1, value_type("all the love in the world", 3));
+ VERIFY( m1.size() == 2 );
+ VERIFY( it2 == it1 );
+ VERIFY( *it2 == value_type("all the love in the world", 1) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc
new file mode 100644
index 000000000..91f58799a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax.cc
@@ -0,0 +1,56 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Array version of insert
+
+#include <string>
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<std::string, int> Map;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ m["red"] = 17;
+ VERIFY( m.size() == 1 );
+ VERIFY( m.begin()->first == "red" );
+ VERIFY( m.begin()->second == 17 );
+ VERIFY( m["red"] == 17 );
+
+ m["blue"] = 9;
+ VERIFY( m.size() == 2 );
+ VERIFY( m["blue"] == 9 );
+
+ m["red"] = 5;
+ VERIFY( m.size() == 2 );
+ VERIFY( m["red"] == 5 );
+ VERIFY( m["blue"] == 9 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax_move.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax_move.cc
new file mode 100644
index 000000000..b0729e327
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/array_syntax_move.cc
@@ -0,0 +1,59 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Array version of insert
+
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<rvalstruct, rvalstruct> Map;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ m[rvalstruct(1)] = rvalstruct(17);
+ VERIFY( m.size() == 1 );
+ VERIFY( (m.begin()->first).val == 1 );
+ VERIFY( (m.begin()->second).val == 17 );
+ VERIFY( m[rvalstruct(1)].val == 17 );
+
+ m[rvalstruct(2)] = rvalstruct(9);
+ VERIFY( m.size() == 2 );
+ VERIFY( m[rvalstruct(2)].val == 9 );
+
+ m[rvalstruct(1)] = rvalstruct(5);
+ VERIFY( m.size() == 2 );
+ VERIFY( m[rvalstruct(1)].val == 5 );
+ VERIFY( m[rvalstruct(2)].val == 9 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_range.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_range.cc
new file mode 100644
index 000000000..5e5298c04
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_range.cc
@@ -0,0 +1,97 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// range insert
+
+#include <string>
+#include <iterator>
+#include <algorithm>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ Pair A[5] =
+ {
+ Pair("red", 5),
+ Pair("green", 9),
+ Pair("blue", 3),
+ Pair("cyan", 8),
+ Pair("magenta", 7)
+ };
+
+ m.insert(A+0, A+5);
+ VERIFY(m.size() == 5);
+ VERIFY(std::distance(m.begin(), m.end()) == 5);
+
+ VERIFY(m["red"] == 5);
+ VERIFY(m["green"] == 9);
+ VERIFY(m["blue"] == 3);
+ VERIFY(m["cyan"] == 8);
+ VERIFY(m["magenta"] == 7);
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ Pair A[9] =
+ {
+ Pair("red", 5),
+ Pair("green", 9),
+ Pair("red", 19),
+ Pair("blue", 3),
+ Pair("blue", 60),
+ Pair("cyan", 8),
+ Pair("magenta", 7),
+ Pair("blue", 99),
+ Pair("green", 33)
+ };
+
+ m.insert(A+0, A+9);
+ VERIFY(m.size() == 5);
+ VERIFY(std::distance(m.begin(), m.end()) == 5);
+
+ VERIFY(m["red"] == 5);
+ VERIFY(m["green"] == 9);
+ VERIFY(m["blue"] == 3);
+ VERIFY(m["cyan"] == 8);
+ VERIFY(m["magenta"] == 7);
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single.cc
new file mode 100644
index 000000000..3905e26c9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single.cc
@@ -0,0 +1,72 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <string>
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ std::pair<Map::iterator, bool> p = m.insert(Pair("abcde", 3));
+ VERIFY(p.second);
+ VERIFY(m.size() == 1);
+ VERIFY(std::distance(m.begin(), m.end()) == 1);
+ VERIFY(p.first == m.begin());
+ VERIFY(p.first->first == "abcde");
+ VERIFY(p.first->second == 3);
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<std::string, int> Map;
+ typedef std::pair<const std::string, int> Pair;
+
+ Map m;
+ VERIFY(m.empty());
+
+ std::pair<Map::iterator, bool> p1 = m.insert(Pair("abcde", 3));
+ std::pair<Map::iterator, bool> p2 = m.insert(Pair("abcde", 7));
+
+ VERIFY(p1.second);
+ VERIFY(!p2.second);
+ VERIFY(m.size() == 1);
+ VERIFY(p1.first == p2.first);
+ VERIFY(p1.first->first == "abcde");
+ VERIFY(p2.first->second == 3);
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-1.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-1.cc
new file mode 100644
index 000000000..45186ce45
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-1.cc
@@ -0,0 +1,76 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<int, rvalstruct> Map;
+ typedef std::pair<const int, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty());
+
+ std::pair<Map::iterator, bool> p = m.insert(Pair(1, rvalstruct(3)));
+ VERIFY( p.second );
+ VERIFY( m.size() == 1 );
+ VERIFY( std::distance(m.begin(), m.end()) == 1 );
+ VERIFY( p.first == m.begin() );
+ VERIFY( p.first->first == 1 );
+ VERIFY( (p.first->second).val == 3 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<int, rvalstruct> Map;
+ typedef std::pair<const int, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ std::pair<Map::iterator, bool> p1 = m.insert(Pair(2, rvalstruct(3)));
+ std::pair<Map::iterator, bool> p2 = m.insert(Pair(2, rvalstruct(7)));
+
+ VERIFY( p1.second );
+ VERIFY( !p2.second );
+ VERIFY( m.size() == 1 );
+ VERIFY( p1.first == p2.first );
+ VERIFY( p1.first->first == 2 );
+ VERIFY( (p2.first->second).val == 3 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-2.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-2.cc
new file mode 100644
index 000000000..76b6bba00
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/map_single_move-2.cc
@@ -0,0 +1,79 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-10-27 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Single-element insert
+
+#include <iterator>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<rvalstruct, rvalstruct> Map;
+ typedef std::pair<rvalstruct, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty());
+
+ std::pair<Map::iterator, bool> p = m.insert(Pair(rvalstruct(1),
+ rvalstruct(3)));
+ VERIFY( p.second );
+ VERIFY( m.size() == 1 );
+ VERIFY( std::distance(m.begin(), m.end()) == 1 );
+ VERIFY( p.first == m.begin() );
+ VERIFY( (p.first->first).val == 1 );
+ VERIFY( (p.first->second).val == 3 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::unordered_map<rvalstruct, rvalstruct> Map;
+ typedef std::pair<rvalstruct, rvalstruct> Pair;
+
+ Map m;
+ VERIFY( m.empty() );
+
+ std::pair<Map::iterator, bool> p1 = m.insert(Pair(rvalstruct(2),
+ rvalstruct(3)));
+ std::pair<Map::iterator, bool> p2 = m.insert(Pair(rvalstruct(2),
+ rvalstruct(7)));
+
+ VERIFY( p1.second );
+ VERIFY( !p2.second );
+ VERIFY( m.size() == 1 );
+ VERIFY( p1.first == p2.first );
+ VERIFY( (p1.first->first).val == 2 );
+ VERIFY( (p2.first->second).val == 3 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/operators/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/operators/1.cc
new file mode 100644
index 000000000..f5e68dea7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/operators/1.cc
@@ -0,0 +1,169 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-03-25 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::pair<const int, int> Pair;
+ std::unordered_map<int, int> um1, um2;
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(1, -1));
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(2, -1));
+ um2.insert(Pair(2, -1));
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(1, -1));
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(3, -3));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um2.insert(Pair(3, -3));
+ VERIFY( (um1 == um2) );
+ VERIFY( !(um1 != um2) );
+
+ um2.clear();
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.clear();
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(2, -2));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.insert(Pair(2, -2));
+ um2.insert(Pair(1, -1));
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(3, -3));
+ um2.insert(Pair(4, -4));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.insert(Pair(4, -4));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um2.insert(Pair(3, -3));
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(1, -1));
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(4, -4));
+ um2.insert(Pair(4, -4));
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.clear();
+ um2.clear();
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(1, -2));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.clear();
+ um2.clear();
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(1, -1));
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(2, -2));
+ um2.insert(Pair(2, -3));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.insert(Pair(2, -3));
+ um2.insert(Pair(2, -2));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.clear();
+ um2.clear();
+ VERIFY( um1 == um2 );
+ VERIFY( !(um1 != um2) );
+
+ um1.insert(Pair(2, -2));
+ um2.insert(Pair(2, -3));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(1, -1));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.insert(Pair(2, -3));
+ um2.insert(Pair(2, -2));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(1, -1));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ um1.insert(Pair(1, -1));
+ um2.insert(Pair(1, -2));
+ VERIFY( um1 != um2 );
+ VERIFY( !(um1 == um2) );
+
+ const std::unordered_map<int, int> cum1(um1), cum2(um2);
+ VERIFY( cum1 != cum2 );
+ VERIFY( !(cum1 == cum2) );
+ VERIFY( cum1 != um2 );
+ VERIFY( !(um1 == cum2) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/profile/hash_map.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/profile/hash_map.cc
new file mode 100644
index 000000000..7939a35e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/profile/hash_map.cc
@@ -0,0 +1,22 @@
+// { dg-options "-Wno-deprecated" }
+/* testing the gcc instrumented */
+
+#include <ext/hash_map>
+using namespace std;
+using __gnu_cxx::hash_map;
+
+int main()
+{
+ hash_map <int, int> *tmp;
+
+ for (int j=1; j<=10; j++)
+ {
+ tmp = new hash_map<int, int>;
+ // Insert more than default item
+ for (int i=0; i<10000*j; i++) {
+ (*tmp)[i]= i;
+ }
+ delete tmp;
+ }
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/profile/unordered.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/profile/unordered.cc
new file mode 100644
index 000000000..93b506e98
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/profile/unordered.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+/* testing the gcc instrumented */
+
+#include <unordered_map>
+#include <unordered_set>
+using std::unordered_map;
+using std::unordered_set;
+
+void test_unordered_set()
+{
+ // Test for unordered set
+ unordered_set <int> *tmp2;
+ tmp2 = new unordered_set<int>;
+ tmp2->insert(1);
+ delete tmp2;
+}
+void test_unordered_map()
+{
+ unordered_map <int, int> *tmp;
+ for (int i=0; i<20; i++)
+ {
+ tmp = new unordered_map<int, int>(i+2);
+ // Insert more than default item
+ for (int j=0; j<10000; j++) {
+ (*tmp)[j]= j;
+ }
+
+ delete tmp;
+ }
+
+ tmp = new unordered_map<int, int>;
+
+ // Insert more than default item
+ for (int i=0; i<150000; i++) {
+// (*tmp)[i] = i;
+ (*tmp).insert(unordered_map<int, int>::value_type(i, i));
+ }
+
+ (*tmp).erase(1);
+ delete tmp;
+}
+int main()
+{
+ test_unordered_set();
+ test_unordered_map();
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc
new file mode 100644
index 000000000..1555c4896
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <unordered_map>
+
+void
+test01()
+{
+ std::unordered_map<int, double> um{{1, 1.0}, {2, 2.0}, {3, 3.0}};
+ std::begin(um);
+ std::end(um);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc
new file mode 100644
index 000000000..a00635a56
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-15 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <testsuite_containers.h>
+
+int main()
+{
+ typedef std::unordered_map<int, int> test_type;
+ __gnu_test::citerator<test_type> test;
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc
new file mode 100644
index 000000000..3cad0a16a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc
@@ -0,0 +1,32 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <testsuite_containers.h>
+
+int main()
+{
+ typedef std::unordered_map<int, int> test_type;
+ typedef typename test_type::value_type value_type;
+ value_type v(1, 1);
+ __gnu_test::forward_members_unordered<test_type> test(v);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_container.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_container.cc
new file mode 100644
index 000000000..632070996
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_container.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <debug/unordered_map>
+
+using namespace __gnu_debug;
+
+using std::allocator;
+using std::equal_to;
+using std::hash;
+using std::pair;
+using std::string;
+
+template class unordered_map<string, float>;
+template class unordered_map<string, int,
+ hash<string>, equal_to<string>,
+ allocator<pair<const string, int> > >;
+template class unordered_map<string, float,
+ hash<string>, equal_to<string>,
+ allocator<char> >;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_mode.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_mode.cc
new file mode 100644
index 000000000..8b2fe14ca
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_mode.cc
@@ -0,0 +1,30 @@
+// NB: This issue affected only debug-mode.
+
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+
+//PR libstdc++/35922
+int main()
+{
+ std::unordered_map<int, int> m;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/basic.cc
new file mode 100644
index 000000000..bcad65f8a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/basic.cc
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-11-30 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <exception/safety.h>
+
+void
+value()
+{
+ typedef __gnu_cxx::throw_value_limit value_type;
+ typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+ typedef std::hash<value_type> hash_type;
+ typedef std::equal_to<value_type> pred_type;
+ typedef std::unordered_map<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
+ __gnu_test::basic_safety<test_type> test;
+}
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ value();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/generation_prohibited.cc
new file mode 100644
index 000000000..7ed320198
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/generation_prohibited.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <exception/safety.h>
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ typedef __gnu_cxx::throw_value_random value_type;
+ typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+ typedef std::hash<value_type> hash_type;
+ typedef std::equal_to<value_type> pred_type;
+ typedef std::unordered_map<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
+ __gnu_test::generation_prohibited<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/propagation_consistent.cc
new file mode 100644
index 000000000..7bb555f41
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/exception/propagation_consistent.cc
@@ -0,0 +1,36 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <exception/safety.h>
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ typedef __gnu_cxx::throw_value_limit value_type;
+ typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+ typedef std::hash<value_type> hash_type;
+ typedef std::equal_to<value_type> pred_type;
+ typedef std::unordered_map<value_type, value_type, hash_type, pred_type, allocator_type> test_type;
+ __gnu_test::propagation_consistent<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000..9027fdcc1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/1.cc
@@ -0,0 +1,23 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+
+template class std::unordered_map<int, float>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/2.cc
new file mode 100644
index 000000000..7f4e05138
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/2.cc
@@ -0,0 +1,32 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// This file tests explicit instantiation of library containers
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+typedef __gnu_test::NonDefaultConstructible inst_type;
+typedef __gnu_test::NonDefaultConstructible_hash hash_type;
+
+// N.B. We cannot instantiate with mapped_type == NonDefaultConstructible
+// because of 23.5.1.2.
+template class std::unordered_map<inst_type, double, hash_type>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc
new file mode 100644
index 000000000..695fa6f58
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc
@@ -0,0 +1,24 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+
+using namespace std;
+template class unordered_map<int, int, hash<int>, equal_to<int>, allocator<char>>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/4.cc
new file mode 100644
index 000000000..37b57b371
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,33 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// This file tests explicit instantiation of library containers
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+typedef __gnu_test::OverloadedAddress inst_type;
+typedef __gnu_test::OverloadedAddress_hash hash_type;
+
+// libstdc++/41792
+template class std::unordered_map<inst_type, inst_type, hash_type>;
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/typedefs.cc
new file mode 100644
index 000000000..9b978cebc
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/typedefs.cc
@@ -0,0 +1,25 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_containers.h>
+#include <unordered_map>
+
+// Check container for required typedefs.
+__gnu_test::types<std::unordered_map<int, long> > t;