summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-15 15:34:14 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-15 15:34:14 +0000
commit709dc99173b17adad3855e8501a709cb7733da9b (patch)
tree8d74c7399d7ca47a8c91d1e7e04159421d2f077b /libstdc++-v3/testsuite
parent0aa8c34eee39336ae1df533ab1aa5709ad456e6d (diff)
downloadppe42-gcc-709dc99173b17adad3855e8501a709cb7733da9b.tar.gz
ppe42-gcc-709dc99173b17adad3855e8501a709cb7733da9b.zip
* include/bits/stl_map.h (map): Implement C++11 allocator-aware
container requirements. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_tree.h (_Rb_tree_node): Use __aligned_buffer and add accessors for value. (_Rb_tree_iterator, _Rb_tree_const_iterator): Use _Rb_tree_node accessors. (_Rb_tree): Use allocator_traits and implement support for sets and maps the be allocator-aware. * include/bits/forward_list.h (_Fwd_list_base::_M_create_node): Do not zero-initialize storage buffer. * include/bits/hashtable_policy.h (_Hashtable_alloc::_M_allocate_node): Likewise. * include/bits/stl_vector.h (vector(vector&&, const allocator_type&)): Add conditional noexcept specification. * doc/xml/manual/status_cxx2011.xml: Update status of containers. * testsuite/util/testsuite_allocator.h: Re-indent. * testsuite/23_containers/forward_list/allocator/copy.cc: Test allocator-extended copy constructor. * testsuite/23_containers/unordered_map/allocator/copy.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: Likewise. * testsuite/23_containers/unordered_multiset/allocator/copy.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/copy.cc: Likewise. * testsuite/23_containers/vector/allocator/copy.cc: Likewise. * testsuite/23_containers/forward_list/allocator/move.cc: New. * testsuite/23_containers/unordered_map/allocator/move.cc: New. * testsuite/23_containers/unordered_multimap/allocator/move.cc: New. * testsuite/23_containers/unordered_multiset/allocator/move.cc: New. * testsuite/23_containers/unordered_set/allocator/move.cc: New. * testsuite/23_containers/vector/allocator/move.cc: New. * testsuite/23_containers/map/allocator/copy.cc: New. * testsuite/23_containers/map/allocator/copy_assign.cc: New. * testsuite/23_containers/map/allocator/minimal.cc: New. * testsuite/23_containers/map/allocator/move.cc: New. * testsuite/23_containers/map/allocator/move_assign.cc: New. * testsuite/23_containers/map/allocator/noexcept.cc: New. * testsuite/23_containers/map/allocator/swap.cc: New. * testsuite/23_containers/multimap/allocator/copy.cc: New. * testsuite/23_containers/multimap/allocator/copy_assign.cc: New. * testsuite/23_containers/multimap/allocator/minimal.cc: New. * testsuite/23_containers/multimap/allocator/move.cc: New. * testsuite/23_containers/multimap/allocator/move_assign.cc: New. * testsuite/23_containers/multimap/allocator/noexcept.cc: New. * testsuite/23_containers/multimap/allocator/swap.cc: New. * testsuite/23_containers/multiset/allocator/copy.cc: New. * testsuite/23_containers/multiset/allocator/copy_assign.cc: New. * testsuite/23_containers/multiset/allocator/minimal.cc: New. * testsuite/23_containers/multiset/allocator/move.cc: New. * testsuite/23_containers/multiset/allocator/move_assign.cc: New. * testsuite/23_containers/multiset/allocator/noexcept.cc: New. * testsuite/23_containers/multiset/allocator/swap.cc: New. * testsuite/23_containers/set/allocator/copy.cc: New. * testsuite/23_containers/set/allocator/copy_assign.cc: New. * testsuite/23_containers/set/allocator/minimal.cc: New. * testsuite/23_containers/set/allocator/move.cc: New. * testsuite/23_containers/set/allocator/move_assign.cc: New. * testsuite/23_containers/set/allocator/noexcept.cc: New. * testsuite/23_containers/set/allocator/swap.cc: New. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust dg-error line number. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204848 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/allocator/copy.cc15
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/allocator/move.cc57
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/allocator/copy.cc76
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/allocator/copy_assign.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/allocator/minimal.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/allocator/move.cc63
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/allocator/move_assign.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/allocator/noexcept.cc83
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/allocator/swap.cc86
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/allocator/copy.cc76
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/allocator/copy_assign.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/allocator/minimal.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/allocator/move.cc63
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/allocator/move_assign.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/allocator/noexcept.cc83
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/allocator/swap.cc86
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/allocator/copy.cc74
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/allocator/copy_assign.cc65
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/allocator/minimal.cc50
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/allocator/move.cc61
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/allocator/move_assign.cc65
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/allocator/noexcept.cc81
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/allocator/swap.cc84
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/allocator/copy.cc74
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/allocator/copy_assign.cc65
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/allocator/minimal.cc50
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/allocator/move.cc63
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/allocator/move_assign.cc65
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/allocator/noexcept.cc81
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/allocator/swap.cc84
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/allocator/copy.cc14
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/allocator/move.cc71
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/copy.cc14
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/move.cc71
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/copy.cc13
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/move.cc69
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/allocator/copy.cc13
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/allocator/move.cc69
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/allocator/copy.cc15
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/allocator/move.cc57
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_allocator.h10
45 files changed, 2435 insertions, 11 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/forward_list/allocator/copy.cc
index f7e781ce9ec..c08e0e105a2 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/allocator/copy.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/allocator/copy.cc
@@ -15,7 +15,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
#include <forward_list>
#include <testsuite_hooks.h>
@@ -49,9 +49,22 @@ void test02()
VERIFY(1 == v2.get_allocator().get_personality());
}
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::forward_list<T, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.push_front(T());
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
int main()
{
test01();
test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/forward_list/allocator/move.cc
new file mode 100644
index 00000000000..04d660a7ceb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/allocator/move.cc
@@ -0,0 +1,57 @@
+// Copyright (C) 2013 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++11" }
+
+#include <forward_list>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::forward_list<T, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { T() };
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::forward_list<T, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { T() };
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/map/allocator/copy.cc
new file mode 100644
index 00000000000..39907d186d9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/allocator/copy.cc
@@ -0,0 +1,76 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(0 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/allocator/copy_assign.cc b/libstdc++-v3/testsuite/23_containers/map/allocator/copy_assign.cc
new file mode 100644
index 00000000000..1c2c8220517
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/allocator/copy_assign.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = v1;
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = v1;
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/allocator/minimal.cc b/libstdc++-v3/testsuite/23_containers/map/allocator/minimal.cc
new file mode 100644
index 00000000000..4a04cfe4be1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/allocator/minimal.cc
@@ -0,0 +1,52 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <memory>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::SimpleAllocator;
+
+template class std::map<T, U, Cmp, SimpleAllocator<std::pair<const T, U>>>;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef SimpleAllocator<std::pair<const T, U>> alloc_type;
+ typedef std::allocator_traits<alloc_type> traits_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v(alloc_type{});
+ v = { test_type::value_type{} };
+ VERIFY( v.max_size() == traits_type::max_size(v.get_allocator()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/map/allocator/move.cc
new file mode 100644
index 00000000000..94354e690b6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/allocator/move.cc
@@ -0,0 +1,63 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<std::pair<const T, U>> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<std::pair<const T, U>> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/allocator/move_assign.cc b/libstdc++-v3/testsuite/23_containers/map/allocator/move_assign.cc
new file mode 100644
index 00000000000..920a38ca38c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/allocator/move_assign.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = std::move(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = std::move(v1);
+ VERIFY(0 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/allocator/noexcept.cc b/libstdc++-v3/testsuite/23_containers/map/allocator/noexcept.cc
new file mode 100644
index 00000000000..832a28ab63a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/allocator/noexcept.cc
@@ -0,0 +1,83 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+namespace __gnu_test
+{
+ inline void
+ swap(propagating_allocator<std::pair<const T, U>, true>& l,
+ propagating_allocator<std::pair<const T, U>, true>& r)
+ noexcept(false)
+ {
+ typedef uneq_allocator<std::pair<const T, U>> base_alloc;
+ swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
+ }
+}
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ typedef std::allocator<std::pair<const T, U>> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1;
+ test_type v2;
+ // this is a GNU extension for std::allocator
+ static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
+ static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
+}
+
+void test02()
+{
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ test_type v2(alloc_type(2));
+ static_assert( !noexcept( v1 = std::move(v2) ), "Move assign can throw" );
+ static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
+}
+
+void test03()
+{
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ test_type v2(alloc_type(2));
+ static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
+ static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/allocator/swap.cc b/libstdc++-v3/testsuite/23_containers/map/allocator/swap.cc
new file mode 100644
index 00000000000..81020fcf1e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/allocator/swap.cc
@@ -0,0 +1,86 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::propagating_allocator;
+
+// It is undefined behaviour to swap() containers wth unequal allocators
+// if the allocator doesn't propagate, so ensure the allocators compare
+// equal, while still being able to test propagation via get_personality().
+bool
+operator==(const propagating_allocator<std::pair<const T, U>, false>&,
+ const propagating_allocator<std::pair<const T, U>, false>&)
+{
+ return true;
+}
+
+bool
+operator!=(const propagating_allocator<std::pair<const T, U>, false>&,
+ const propagating_allocator<std::pair<const T, U>, false>&)
+{
+ return false;
+}
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ std::swap(v1, v2);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+ // swap back so assertions in uneq_allocator::deallocate don't fail
+ std::swap(v1, v2);
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::map<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ std::swap(v1, v2);
+ VERIFY(2 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/multimap/allocator/copy.cc
new file mode 100644
index 00000000000..fdf197d2970
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/allocator/copy.cc
@@ -0,0 +1,76 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(0 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/allocator/copy_assign.cc b/libstdc++-v3/testsuite/23_containers/multimap/allocator/copy_assign.cc
new file mode 100644
index 00000000000..3f67999559f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/allocator/copy_assign.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = v1;
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = v1;
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/allocator/minimal.cc b/libstdc++-v3/testsuite/23_containers/multimap/allocator/minimal.cc
new file mode 100644
index 00000000000..92ad4895e82
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/allocator/minimal.cc
@@ -0,0 +1,52 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <memory>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::SimpleAllocator;
+
+template class std::multimap<T, U, Cmp, SimpleAllocator<std::pair<const T, U>>>;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef SimpleAllocator<std::pair<const T, U>> alloc_type;
+ typedef std::allocator_traits<alloc_type> traits_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v(alloc_type{});
+ v = { test_type::value_type{} };
+ VERIFY( v.max_size() == traits_type::max_size(v.get_allocator()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/multimap/allocator/move.cc
new file mode 100644
index 00000000000..7a80ce653fb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/allocator/move.cc
@@ -0,0 +1,63 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<std::pair<const T, U>> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<std::pair<const T, U>> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/allocator/move_assign.cc b/libstdc++-v3/testsuite/23_containers/multimap/allocator/move_assign.cc
new file mode 100644
index 00000000000..70e2d488c92
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/allocator/move_assign.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = std::move(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = std::move(v1);
+ VERIFY(0 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/allocator/noexcept.cc b/libstdc++-v3/testsuite/23_containers/multimap/allocator/noexcept.cc
new file mode 100644
index 00000000000..aee4dc90029
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/allocator/noexcept.cc
@@ -0,0 +1,83 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+namespace __gnu_test
+{
+ inline void
+ swap(propagating_allocator<std::pair<const T, U>, true>& l,
+ propagating_allocator<std::pair<const T, U>, true>& r)
+ noexcept(false)
+ {
+ typedef uneq_allocator<std::pair<const T, U>> base_alloc;
+ swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
+ }
+}
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ typedef std::allocator<std::pair<const T, U>> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1;
+ test_type v2;
+ // this is a GNU extension for std::allocator
+ static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
+ static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
+}
+
+void test02()
+{
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ test_type v2(alloc_type(2));
+ static_assert( !noexcept( v1 = std::move(v2) ), "Move assign can throw" );
+ static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
+}
+
+void test03()
+{
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ test_type v2(alloc_type(2));
+ static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
+ static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/allocator/swap.cc b/libstdc++-v3/testsuite/23_containers/multimap/allocator/swap.cc
new file mode 100644
index 00000000000..57e460c32ca
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/allocator/swap.cc
@@ -0,0 +1,86 @@
+// Copyright (C) 2013 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++11" }
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::propagating_allocator;
+
+// It is undefined behaviour to swap() containers wth unequal allocators
+// if the allocator doesn't propagate, so ensure the allocators compare
+// equal, while still being able to test propagation via get_personality().
+bool
+operator==(const propagating_allocator<std::pair<const T, U>, false>&,
+ const propagating_allocator<std::pair<const T, U>, false>&)
+{
+ return true;
+}
+
+bool
+operator!=(const propagating_allocator<std::pair<const T, U>, false>&,
+ const propagating_allocator<std::pair<const T, U>, false>&)
+{
+ return false;
+}
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, false> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ std::swap(v1, v2);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+ // swap back so assertions in uneq_allocator::deallocate don't fail
+ std::swap(v1, v2);
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<std::pair<const T, U>, true> alloc_type;
+ typedef std::multimap<T, U, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ std::swap(v1, v2);
+ VERIFY(2 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/multiset/allocator/copy.cc
new file mode 100644
index 00000000000..cecde4f3e1c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/allocator/copy.cc
@@ -0,0 +1,74 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(0 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/allocator/copy_assign.cc b/libstdc++-v3/testsuite/23_containers/multiset/allocator/copy_assign.cc
new file mode 100644
index 00000000000..6b47b099293
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/allocator/copy_assign.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = v1;
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = v1;
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/allocator/minimal.cc b/libstdc++-v3/testsuite/23_containers/multiset/allocator/minimal.cc
new file mode 100644
index 00000000000..8be5394a42b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/allocator/minimal.cc
@@ -0,0 +1,50 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <memory>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::SimpleAllocator;
+
+template class std::multiset<T, Cmp, SimpleAllocator<T>>;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef SimpleAllocator<T> alloc_type;
+ typedef std::allocator_traits<alloc_type> traits_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v(alloc_type{});
+ v = { test_type::value_type{} };
+ VERIFY( v.max_size() == traits_type::max_size(v.get_allocator()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/multiset/allocator/move.cc
new file mode 100644
index 00000000000..819d18d3fd4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/allocator/move.cc
@@ -0,0 +1,61 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/allocator/move_assign.cc b/libstdc++-v3/testsuite/23_containers/multiset/allocator/move_assign.cc
new file mode 100644
index 00000000000..f553a95bf0d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/allocator/move_assign.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = std::move(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = std::move(v1);
+ VERIFY(0 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/allocator/noexcept.cc b/libstdc++-v3/testsuite/23_containers/multiset/allocator/noexcept.cc
new file mode 100644
index 00000000000..89b0053d4c2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/allocator/noexcept.cc
@@ -0,0 +1,81 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+namespace __gnu_test
+{
+ inline void
+ swap(propagating_allocator<T, true>& l,
+ propagating_allocator<T, true>& r)
+ noexcept(false)
+ {
+ typedef uneq_allocator<T> base_alloc;
+ swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
+ }
+}
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ typedef std::allocator<T> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1;
+ test_type v2;
+ // this is a GNU extension for std::allocator
+ static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
+ static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
+}
+
+void test02()
+{
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ test_type v2(alloc_type(2));
+ static_assert( !noexcept( v1 = std::move(v2) ), "Move assign can throw" );
+ static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
+}
+
+void test03()
+{
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ test_type v2(alloc_type(2));
+ static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
+ static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/allocator/swap.cc b/libstdc++-v3/testsuite/23_containers/multiset/allocator/swap.cc
new file mode 100644
index 00000000000..f92ff074d0f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/allocator/swap.cc
@@ -0,0 +1,84 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::propagating_allocator;
+
+// It is undefined behaviour to swap() containers wth unequal allocators
+// if the allocator doesn't propagate, so ensure the allocators compare
+// equal, while still being able to test propagation via get_personality().
+bool
+operator==(const propagating_allocator<T, false>&,
+ const propagating_allocator<T, false>&)
+{
+ return true;
+}
+
+bool
+operator!=(const propagating_allocator<T, false>&,
+ const propagating_allocator<T, false>&)
+{
+ return false;
+}
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ std::swap(v1, v2);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+ // swap back so assertions in uneq_allocator::deallocate don't fail
+ std::swap(v1, v2);
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::multiset<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ std::swap(v1, v2);
+ VERIFY(2 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/set/allocator/copy.cc
new file mode 100644
index 00000000000..ac717f0e6b6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/allocator/copy.cc
@@ -0,0 +1,74 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(0 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/allocator/copy_assign.cc b/libstdc++-v3/testsuite/23_containers/set/allocator/copy_assign.cc
new file mode 100644
index 00000000000..5ac37c6d22c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/allocator/copy_assign.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = v1;
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = v1;
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/allocator/minimal.cc b/libstdc++-v3/testsuite/23_containers/set/allocator/minimal.cc
new file mode 100644
index 00000000000..dd4c3b94c18
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/allocator/minimal.cc
@@ -0,0 +1,50 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <memory>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::SimpleAllocator;
+
+template class std::set<T, Cmp, SimpleAllocator<T>>;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef SimpleAllocator<T> alloc_type;
+ typedef std::allocator_traits<alloc_type> traits_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v(alloc_type{});
+ v = { test_type::value_type{} };
+ VERIFY( v.max_size() == traits_type::max_size(v.get_allocator()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/set/allocator/move.cc
new file mode 100644
index 00000000000..0fdd9a0fe1a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/allocator/move.cc
@@ -0,0 +1,63 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+struct U { };
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/allocator/move_assign.cc b/libstdc++-v3/testsuite/23_containers/set/allocator/move_assign.cc
new file mode 100644
index 00000000000..60ef2affb5e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/allocator/move_assign.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = std::move(v1);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ v2 = std::move(v1);
+ VERIFY(0 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/allocator/noexcept.cc b/libstdc++-v3/testsuite/23_containers/set/allocator/noexcept.cc
new file mode 100644
index 00000000000..07adbc08013
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/allocator/noexcept.cc
@@ -0,0 +1,81 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+namespace __gnu_test
+{
+ inline void
+ swap(propagating_allocator<T, true>& l,
+ propagating_allocator<T, true>& r)
+ noexcept(false)
+ {
+ typedef uneq_allocator<T> base_alloc;
+ swap(static_cast<base_alloc&>(l), static_cast<base_alloc&>(r));
+ }
+}
+
+using __gnu_test::propagating_allocator;
+
+void test01()
+{
+ typedef std::allocator<T> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1;
+ test_type v2;
+ // this is a GNU extension for std::allocator
+ static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
+ static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
+}
+
+void test02()
+{
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ test_type v2(alloc_type(2));
+ static_assert( !noexcept( v1 = std::move(v2) ), "Move assign can throw" );
+ static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
+}
+
+void test03()
+{
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ test_type v2(alloc_type(2));
+ static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
+ static_assert( !noexcept( v1.swap(v2) ), "Swap can throw" );
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/allocator/swap.cc b/libstdc++-v3/testsuite/23_containers/set/allocator/swap.cc
new file mode 100644
index 00000000000..d5bc122abb8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/allocator/swap.cc
@@ -0,0 +1,84 @@
+// Copyright (C) 2013 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++11" }
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+bool operator<(T l, T r) { return l.i < r.i; }
+
+using Cmp = std::less<T>;
+
+using __gnu_test::propagating_allocator;
+
+// It is undefined behaviour to swap() containers wth unequal allocators
+// if the allocator doesn't propagate, so ensure the allocators compare
+// equal, while still being able to test propagation via get_personality().
+bool
+operator==(const propagating_allocator<T, false>&,
+ const propagating_allocator<T, false>&)
+{
+ return true;
+}
+
+bool
+operator!=(const propagating_allocator<T, false>&,
+ const propagating_allocator<T, false>&)
+{
+ return false;
+}
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, false> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ std::swap(v1, v2);
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+ // swap back so assertions in uneq_allocator::deallocate don't fail
+ std::swap(v1, v2);
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::set<T, Cmp, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { test_type::value_type{} };
+ test_type v2(alloc_type(2));
+ v2 = { test_type::value_type{} };
+ std::swap(v1, v2);
+ VERIFY(2 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/copy.cc
index 3b85f6fc249..faa3d127865 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/copy.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/copy.cc
@@ -63,9 +63,23 @@ void test02()
VERIFY(1 == v2.get_allocator().get_personality());
}
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.emplace(std::piecewise_construct,
+ std::make_tuple(T()), std::make_tuple(T()));
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
int main()
{
test01();
test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/move.cc
new file mode 100644
index 00000000000..d2648026bbb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/move.cc
@@ -0,0 +1,71 @@
+// Copyright (C) 2013 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=c++11" }
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+struct hash
+{
+ std::size_t operator()(const T t) const noexcept
+ { return t.i; }
+};
+
+struct equal_to
+{
+ bool operator()(const T& lhs, const T& rhs) const noexcept
+ { return lhs.i == rhs.i; }
+};
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.emplace(std::piecewise_construct,
+ std::make_tuple(T()), std::make_tuple(T()));
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::unordered_map<T, T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.emplace(std::piecewise_construct,
+ std::make_tuple(T()), std::make_tuple(T()));
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/copy.cc
index 74c8f19455d..1a6a0bb6b96 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/copy.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/copy.cc
@@ -63,9 +63,23 @@ void test02()
VERIFY(1 == v2.get_allocator().get_personality());
}
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.emplace(std::piecewise_construct,
+ std::make_tuple(T()), std::make_tuple(T()));
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
int main()
{
test01();
test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/move.cc
new file mode 100644
index 00000000000..fba6abbb22a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/allocator/move.cc
@@ -0,0 +1,71 @@
+// Copyright (C) 2013 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=c++11" }
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+struct hash
+{
+ std::size_t operator()(const T t) const noexcept
+ { return t.i; }
+};
+
+struct equal_to
+{
+ bool operator()(const T& lhs, const T& rhs) const noexcept
+ { return lhs.i == rhs.i; }
+};
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.emplace(std::piecewise_construct,
+ std::make_tuple(T()), std::make_tuple(T()));
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::unordered_multimap<T, T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.emplace(std::piecewise_construct,
+ std::make_tuple(T()), std::make_tuple(T()));
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/copy.cc
index 94b032b80de..f5f01dc3140 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/copy.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/copy.cc
@@ -61,9 +61,22 @@ void test02()
VERIFY(1 == v2.get_allocator().get_personality());
}
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::unordered_multiset<T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.insert(T());
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
int main()
{
test01();
test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/move.cc
new file mode 100644
index 00000000000..da1de2c861f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/allocator/move.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2013 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=c++11" }
+
+#include <unordered_set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+struct hash
+{
+ std::size_t operator()(const T t) const noexcept
+ { return t.i; }
+};
+
+struct equal_to
+{
+ bool operator()(const T& lhs, const T& rhs) const noexcept
+ { return lhs.i == rhs.i; }
+};
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::unordered_multiset<T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.insert(T());
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::unordered_multiset<T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.insert(T());
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/copy.cc
index 8f1b7ee638c..500d7c8081a 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/copy.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/copy.cc
@@ -61,9 +61,22 @@ void test02()
VERIFY(1 == v2.get_allocator().get_personality());
}
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::unordered_set<T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.insert(T());
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
int main()
{
test01();
test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/move.cc
new file mode 100644
index 00000000000..865dcaeb7b5
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/move.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2013 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=c++11" }
+
+#include <unordered_set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+struct hash
+{
+ std::size_t operator()(const T t) const noexcept
+ { return t.i; }
+};
+
+struct equal_to
+{
+ bool operator()(const T& lhs, const T& rhs) const noexcept
+ { return lhs.i == rhs.i; }
+};
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::unordered_set<T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.insert(T());
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::unordered_set<T, hash, equal_to, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.insert(T());
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/allocator/copy.cc b/libstdc++-v3/testsuite/23_containers/vector/allocator/copy.cc
index f95c345b853..1b528927bc0 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/allocator/copy.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/allocator/copy.cc
@@ -15,7 +15,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-options "-std=gnu++0x" }
+// { dg-options "-std=gnu++11" }
#include <vector>
#include <testsuite_hooks.h>
@@ -49,9 +49,22 @@ void test02()
VERIFY(1 == v2.get_allocator().get_personality());
}
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef propagating_allocator<T, true> alloc_type;
+ typedef std::vector<T, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1.push_back(T());
+ test_type v2(v1, alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
int main()
{
test01();
test02();
+ test03();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/allocator/move.cc b/libstdc++-v3/testsuite/23_containers/vector/allocator/move.cc
new file mode 100644
index 00000000000..810e66df0c9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/allocator/move.cc
@@ -0,0 +1,57 @@
+// Copyright (C) 2013 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++11" }
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+struct T { int i; };
+
+using __gnu_test::uneq_allocator;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::vector<T, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { T() };
+ test_type v2(std::move(v1));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(1 == v2.get_allocator().get_personality());
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef uneq_allocator<T> alloc_type;
+ typedef std::vector<T, alloc_type> test_type;
+ test_type v1(alloc_type(1));
+ v1 = { T() };
+ test_type v2(std::move(v1), alloc_type(2));
+ VERIFY(1 == v1.get_allocator().get_personality());
+ VERIFY(2 == v2.get_allocator().get_personality());
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index b8a6621b339..35da91eb40d 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1305 }
+// { dg-error "no matching" "" { target *-*-* } 1306 }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
index ec3aa5a62e8..9f025d17037 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1231 }
+// { dg-error "no matching" "" { target *-*-* } 1232 }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
index 5c7d436ad34..cc178cb02d7 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1231 }
+// { dg-error "no matching" "" { target *-*-* } 1232 }
#include <vector>
#include <utility>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
index 2daaf527197..ac48068929c 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1346 }
+// { dg-error "no matching" "" { target *-*-* } 1347 }
#include <vector>
diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
index d569eb0712d..3dcd94e13c6 100644
--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
@@ -411,11 +411,11 @@ namespace __gnu_test
propagating_allocator&
operator=(const propagating_allocator& a) noexcept
- {
- static_assert(Propagate, "assigning propagating_allocator<T, true>");
- propagating_allocator(a).swap_base(*this);
- return *this;
- }
+ {
+ static_assert(Propagate, "assigning propagating_allocator<T, true>");
+ propagating_allocator(a).swap_base(*this);
+ return *this;
+ }
template<bool P2>
propagating_allocator&
OpenPOWER on IntegriCloud