summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/set
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/23_containers/set
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/set')
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/14340.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/18604.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/23781_neg.cc28
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/check_construct_destroy.cc76
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/construct1_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/construct2_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/construct3_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/insert1_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/insert2_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/insert3_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc51
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc70
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/dr130.cc75
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/init-list.cc59
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc92
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc44
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/erase/51142.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/insert/1.cc83
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/insert/2.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/insert/3.cc64
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/swap/1.cc65
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/swap/2.cc137
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/modifiers/swap/3.cc166
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/operations/1.cc126
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/range_access.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc41
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/exception/generation_prohibited.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/exception/propagation_consistent.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1_c++0x.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/3.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/partial_specialization/1.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc25
41 files changed, 2066 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/set/14340.cc b/libstdc++-v3/testsuite/23_containers/set/14340.cc
new file mode 100644
index 000000000..8539544e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/14340.cc
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_hooks.h>
+#include <set>
+
+// NB: This issue affected only debug-mode.
+
+// { dg-do compile }
+
+// libstdc++/14340
+int main()
+{
+ typedef std::set<int> container;
+ __gnu_test::conversion<container>::iterator_to_const_iterator();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/18604.cc b/libstdc++-v3/testsuite/23_containers/set/18604.cc
new file mode 100644
index 000000000..a57f95f4b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/18604.cc
@@ -0,0 +1,43 @@
+// 2005-05-09 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This issue affected only debug-mode.
+
+// { dg-do compile }
+
+// libstdc++/18604
+struct less;
+struct allocator;
+struct pair;
+struct binary_function;
+struct iterator;
+struct iterator_traits;
+struct bidirectional_iterator_tag;
+struct forward_iterator_tag;
+struct input_iterator_tag;
+struct random_access_iterator_tag;
+struct ios_base;
+struct basic_string;
+struct basic_istream;
+struct basic_ostream;
+struct char_traits;
+
+#include <set>
+
diff --git a/libstdc++-v3/testsuite/23_containers/set/23781_neg.cc b/libstdc++-v3/testsuite/23_containers/set/23781_neg.cc
new file mode 100644
index 000000000..b47b748ec
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/23781_neg.cc
@@ -0,0 +1,28 @@
+// 2005-09-10 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+// { dg-do compile }
+
+// libstdc++/23781
+#include <set>
+#include <cstddef>
+
+std::set<int>::iterator it = NULL; // { dg-error "conversion" }
+std::set<int>::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc
new file mode 100644
index 000000000..7d9bccd0f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc
@@ -0,0 +1,38 @@
+// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.3.3 set capacity
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::set<int> s;
+
+ VERIFY( s.max_size() ==
+ std::allocator<std::_Rb_tree_node<int> >().max_size() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/check_construct_destroy.cc b/libstdc++-v3/testsuite/23_containers/set/check_construct_destroy.cc
new file mode 100644
index 000000000..6a9bf611c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/check_construct_destroy.cc
@@ -0,0 +1,76 @@
+// 2004-07-26 Matt Austern <austern@apple.com>
+//
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <set>
+#include <functional>
+#include <iterator>
+#include <testsuite_allocator.h>
+
+using namespace __gnu_test;
+
+int main()
+{
+ typedef std::set<int, std::less<int>, tracker_allocator<int> > Container;
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ const int arr10a[10] = { 31, 23, 82, 46, 13, 17, 30, 71, 22, 51 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ Container c;
+ ok = check_construct_destroy("empty container", 0, 0) && ok;
+ }
+ ok = check_construct_destroy("empty container", 0, 0) && ok;
+
+
+ tracker_allocator_counter::reset();
+ {
+ Container c(arr10, arr10 + 10);
+ ok = check_construct_destroy("Construct from range", 10, 0) && ok;
+ }
+ ok = check_construct_destroy("Construct from range", 10, 10) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ c.insert(arr10a[0]);
+ ok = check_construct_destroy("Insert element", 1, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert element", 1, 11) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ c.insert(arr10a, arr10a+3);
+ ok = check_construct_destroy("Insert short range", 3, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert short range", 3, 13) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ c.insert(arr10a, arr10a+10);
+ ok = check_construct_destroy("Insert long range", 10, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert long range", 10, 20) && ok;
+
+ return ok ? 0 : 1;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc
new file mode 100644
index 000000000..9c43e3833
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/cons/moveable.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on set (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <set>
+#include <utility>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::set<int> a,b;
+ a.insert(2);
+ b.insert(1);
+ b = std::move(a);
+ VERIFY(b.find(2) != b.end() && a.find(1) == a.end());
+
+ std::set<int> c(std::move(b));
+ VERIFY( c.find(2) != c.end());
+ VERIFY( b.find(2) == b.end());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/construct1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct1_neg.cc
new file mode 100644
index 000000000..424eb8be2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/construct1_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-do run { xfail *-*-* } }
+
+#include <set>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct1<std::set<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/construct2_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct2_neg.cc
new file mode 100644
index 000000000..d5819925b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/construct2_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-do run { xfail *-*-* } }
+
+#include <set>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct2<std::set<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/construct3_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct3_neg.cc
new file mode 100644
index 000000000..1cc7dd234
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/construct3_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-do run { xfail *-*-* } }
+
+#include <set>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct3<std::set<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc
new file mode 100644
index 000000000..d464aabfb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/construct4_neg.cc
@@ -0,0 +1,32 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-do run { xfail *-*-* } }
+
+#include <debug/set>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct1<__gnu_debug::set<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/insert1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert1_neg.cc
new file mode 100644
index 000000000..3192ff959
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/insert1_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-do run { xfail *-*-* } }
+
+#include <set>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert1<std::set<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/insert2_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert2_neg.cc
new file mode 100644
index 000000000..d0d16cfb9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/insert2_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-do run { xfail *-*-* } }
+
+#include <set>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert2<std::set<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/insert3_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert3_neg.cc
new file mode 100644
index 000000000..9eaf6f82b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/insert3_neg.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-do run { xfail *-*-* } }
+
+#include <set>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert3<std::set<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc
new file mode 100644
index 000000000..c2424d2a3
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/insert4_neg.cc
@@ -0,0 +1,32 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-do run { xfail *-*-* } }
+
+#include <debug/set>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert1<__gnu_debug::set<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc
new file mode 100644
index 000000000..6d5a0f50b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/1.cc
@@ -0,0 +1,51 @@
+// Set iterator invalidation tests
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <debug/set>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::set;
+using std::advance;
+
+bool test = true;
+
+// Assignment
+void test01()
+{
+ set<int> v1;
+ set<int> v2;
+
+ v1.insert(17);
+
+ set<int>::iterator start = v1.begin();
+ set<int>::iterator finish = v1.end();
+ VERIFY(start._M_dereferenceable());
+ VERIFY(!finish._M_dereferenceable() && !finish._M_singular());
+
+ v1 = v2;
+ VERIFY(start._M_singular());
+ VERIFY(!finish._M_dereferenceable() && !finish._M_singular());
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc
new file mode 100644
index 000000000..2539b03dd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/debug/invalidation/2.cc
@@ -0,0 +1,70 @@
+// Set iterator invalidation tests
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <debug/set>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::set;
+using std::advance;
+
+// Erase
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ set<int> v;
+ for (int i = 0; i < 20; ++i)
+ v.insert(i);
+
+ // Single element erase (middle)
+ set<int>::iterator before = v.begin();
+ set<int>::iterator at = before;
+ advance(at, 3);
+ set<int>::iterator after = at;
+ ++after;
+ v.erase(at);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+ VERIFY(after._M_dereferenceable());
+
+ // Multiple element erase
+ before = v.begin();
+ at = before;
+ advance(at, 3);
+ after = at;
+ advance(after, 4);
+ v.erase(at, after);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+
+ // clear()
+ before = v.begin();
+ set<int>::iterator finish = v.end();
+ VERIFY(before._M_dereferenceable());
+ v.clear();
+ VERIFY(before._M_singular());
+ VERIFY(!finish._M_singular() && !finish._M_dereferenceable());
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/dr130.cc b/libstdc++-v3/testsuite/23_containers/set/dr130.cc
new file mode 100644
index 000000000..1dac5628d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/dr130.cc
@@ -0,0 +1,75 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-07-22 Edward Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// DR 130. Associative erase should return an iterator.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ set<int> s0;
+ typedef set<int>::iterator iterator;
+ typedef set<int>::const_iterator const_iterator;
+ typedef pair<iterator, bool> insert_return_type;
+
+ s0.insert(1);
+ insert_return_type irt1 = s0.insert(2);
+ insert_return_type irt2 = s0.insert(3);
+
+ iterator pos1 = s0.erase(irt1.first);
+ VERIFY( pos1 == irt2.first );
+
+ iterator pos2 = s0.erase(irt2.first);
+ VERIFY( pos2 == s0.end() );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ set<int> s0;
+ typedef set<int>::iterator iterator;
+ typedef set<int>::const_iterator const_iterator;
+ typedef pair<iterator, bool> insert_return_type;
+
+ insert_return_type irt0 = s0.insert(1);
+ s0.insert(2);
+ insert_return_type irt2 = s0.insert(3);
+ insert_return_type irt3 = s0.insert(4);
+
+ iterator pos1 = s0.erase(irt0.first, irt2.first);
+ VERIFY( pos1 == irt2.first );
+
+ iterator pos2 = s0.erase(irt2.first, ++irt3.first);
+ VERIFY( pos2 == s0.end() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/init-list.cc b/libstdc++-v3/testsuite/23_containers/set/init-list.cc
new file mode 100644
index 000000000..e0b3d6b95
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/init-list.cc
@@ -0,0 +1,59 @@
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+// { dg-options "-std=gnu++0x" }
+
+#include <set>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ set<int> m({ 1, 5, 37 });
+ VERIFY(m.size() == 3);
+ VERIFY(m.count(1) == 1);
+ VERIFY(m.count(5) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(42) == 0);
+
+ m = { 28, 37, 102 };
+ VERIFY(m.size() == 3);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(1) == 0);
+
+ m.insert({ 42 });
+ VERIFY(m.size() == 4);
+ VERIFY(m.count(28) == 1);
+ VERIFY(m.count(37) == 1);
+ VERIFY(m.count(102) == 1);
+ VERIFY(m.count(42) == 1);
+ VERIFY(m.count(1) == 0);
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc
new file mode 100644
index 000000000..28376a353
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/16728.cc
@@ -0,0 +1,92 @@
+// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+/*
+ * The goal with this application is to compare the performance
+ * between different std::allocator implementations. The results are
+ * influenced by the underlying allocator in the "C" library, malloc.
+ */
+
+#include <set>
+#include <sstream>
+
+using namespace std;
+
+typedef int test_type;
+
+// This can take extremely long on simulators, timing out the test.
+// { dg-options "-DITERATIONS=10" { target simulator } }
+#ifndef ITERATIONS
+#define ITERATIONS 10000
+#endif
+
+// The number of iterations to be performed.
+int iterations = ITERATIONS;
+
+// The number of values to insert in the container, 32 will cause 5
+// (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
+// This means that all allocations are within _MAX_BYTES = 128 as
+// defined in stl_alloc.h for __pool_alloc. Whether or not this
+// value is relevant in "the real world" or not I don't know and
+// should probably be investigated in more detail.
+int insert_values = 128;
+
+template<typename TestType>
+ struct value_type : public pair<TestType, TestType>
+ {
+ value_type() : pair<TestType, TestType>(0, 0) { }
+
+ inline value_type operator++() { return ++this->first, *this; }
+ inline operator TestType() const { return this->first; }
+ };
+
+template<typename Container>
+ void
+ do_loop()
+ {
+ Container obj;
+ int test_iterations = 0;
+ value_type<test_type> test_value;
+ while (test_iterations < iterations)
+ {
+ for (int j = 0; j < insert_values; ++j)
+ obj.insert(obj.end(), ++test_value);
+ ++test_iterations;
+ }
+ }
+
+template<typename Container>
+ void
+ test_container(Container, bool run_threaded = false)
+ {
+ do_loop<Container>();
+ std::ostringstream comment;
+ if (run_threaded)
+ comment << "4-way threaded iterations: " << iterations*4 << '\t';
+ else
+ comment << "iterations: " << iterations << '\t';
+ }
+
+// http://gcc.gnu.org/ml/libstdc++/2001-05/msg00105.html
+// http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html
+int main(void)
+{
+ typedef less<test_type> compare_type;
+ test_container(set<test_type, compare_type>());
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc
new file mode 100644
index 000000000..baee1fe8a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/17948.cc
@@ -0,0 +1,44 @@
+// Copyright (C) 2004, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// libstdc++/17948
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef set<int>::size_type size_type;
+
+ set<int> s;
+
+ s.insert(2);
+ s.insert(3);
+
+ size_type x = s.erase(3);
+
+ VERIFY( s.size() == 1 );
+ VERIFY( x == 1 );
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/51142.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/51142.cc
new file mode 100644
index 000000000..4fb296a95
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/51142.cc
@@ -0,0 +1,38 @@
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+#include <set>
+
+struct X
+{
+ template<typename T>
+ X(T&) {}
+};
+
+bool operator<(const X&, const X&) { return false; }
+
+// LWG 2059.
+void erasor(std::set<X>& s, X x)
+{
+ std::set<X>::iterator it = s.find(x);
+ if (it != s.end())
+ s.erase(it);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/1.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/1.cc
new file mode 100644
index 000000000..0b2dd3e2a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/1.cc
@@ -0,0 +1,83 @@
+// 2005-01-17 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// A few tests for insert with hint, in the occasion of libstdc++/19422
+// and libstdc++/19433.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ set<int> s0, s1;
+ set<int>::iterator iter1;
+
+ s0.insert(1);
+ s1.insert(s1.end(), 1);
+ VERIFY( s0 == s1 );
+
+ s0.insert(3);
+ s1.insert(s1.begin(), 3);
+ VERIFY( s0 == s1 );
+
+ s0.insert(4);
+ iter1 = s1.insert(s1.end(), 4);
+ VERIFY( s0 == s1 );
+
+ s0.insert(6);
+ s1.insert(iter1, 6);
+ VERIFY( s0 == s1 );
+
+ s0.insert(2);
+ s1.insert(s1.begin(), 2);
+ VERIFY( s0 == s1 );
+
+ s0.insert(7);
+ s1.insert(s1.end(), 7);
+ VERIFY( s0 == s1 );
+
+ s0.insert(5);
+ s1.insert(s1.find(4), 5);
+ VERIFY( s0 == s1 );
+
+ s0.insert(0);
+ s1.insert(s1.end(), 0);
+ VERIFY( s0 == s1 );
+
+ s0.insert(8);
+ s1.insert(s1.find(3), 8);
+ VERIFY( s0 == s1 );
+
+ s0.insert(9);
+ s1.insert(s1.end(), 9);
+ VERIFY( s0 == s1 );
+
+ s0.insert(10);
+ s1.insert(s1.begin(), 10);
+ VERIFY( s0 == s1 );
+}
+
+int main ()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/2.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/2.cc
new file mode 100644
index 000000000..31159262b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/2.cc
@@ -0,0 +1,67 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-11-10 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::set<rvalstruct> Set;
+ Set s;
+ VERIFY( s.empty() );
+
+ std::pair<Set::iterator, bool> p = s.insert(rvalstruct(1));
+ VERIFY( p.second );
+ VERIFY( s.size() == 1 );
+ VERIFY( std::distance(s.begin(), s.end()) == 1 );
+ VERIFY( p.first == s.begin() );
+ VERIFY( (*p.first).val == 1 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::set<rvalstruct> Set;
+ Set s;
+ VERIFY( s.empty() );
+
+ std::pair<Set::iterator, bool> p1 = s.insert(rvalstruct(2));
+ std::pair<Set::iterator, bool> p2 = s.insert(rvalstruct(2));
+ VERIFY( p1.second );
+ VERIFY( !p2.second );
+ VERIFY( s.size() == 1 );
+ VERIFY( p1.first == p2.first );
+ VERIFY( (*p1.first).val == 2 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/3.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/3.cc
new file mode 100644
index 000000000..03e0d9d6c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/insert/3.cc
@@ -0,0 +1,64 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-11-10 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::set<rvalstruct> Set;
+ Set s;
+ VERIFY( s.empty() );
+
+ Set::iterator p = s.insert(s.begin(), rvalstruct(1));
+ VERIFY( s.size() == 1 );
+ VERIFY( std::distance(s.begin(), s.end()) == 1 );
+ VERIFY( p == s.begin() );
+ VERIFY( (*p).val == 1 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::rvalstruct;
+
+ typedef std::set<rvalstruct> Set;
+ Set s;
+ VERIFY( s.empty() );
+
+ Set::iterator p1 = s.insert(s.begin(), rvalstruct(2));
+ Set::iterator p2 = s.insert(p1, rvalstruct(2));
+ VERIFY( s.size() == 1 );
+ VERIFY( p1 == p2 );
+ VERIFY( (*p1).val == 2 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/1.cc
new file mode 100644
index 000000000..789185f8f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/1.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2004, 2005, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <set>
+#include <testsuite_hooks.h>
+
+struct T { int i; };
+
+// T must be LessThanComparable to pass concept-checks
+bool operator<(T l, T r) { return l.i < r.i; }
+
+int swap_calls;
+
+namespace std
+{
+ template<>
+ void
+ set<T>::swap(set<T>&)
+ { ++swap_calls; }
+}
+
+// Should use set specialization for swap.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::set<T> A;
+ std::set<T> B;
+ swap_calls = 0;
+ std::swap(A, B);
+ VERIFY(1 == swap_calls);
+}
+
+// Should use set specialization for swap.
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+ set<T> A;
+ set<T> B;
+ swap_calls = 0;
+ swap(A, B);
+ VERIFY(1 == swap_calls);
+}
+
+// See c++/13658 for background info.
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/2.cc
new file mode 100644
index 000000000..8899b6dae
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/2.cc
@@ -0,0 +1,137 @@
+// 2005-12-20 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.3.3 set::swap
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator as a non-empty allocator.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef __gnu_test::uneq_allocator<char> my_alloc;
+ typedef set<char, less<char>, my_alloc> my_set;
+
+ const char title01[] = "Rivers of sand";
+ const char title02[] = "Concret PH";
+ const char title03[] = "Sonatas and Interludes for Prepared Piano";
+ const char title04[] = "never as tired as when i'm waking up";
+
+ const size_t N1 = sizeof(title01);
+ const size_t N2 = sizeof(title02);
+ const size_t N3 = sizeof(title03);
+ const size_t N4 = sizeof(title04);
+
+ const set<char> set01_ref(title01, title01 + N1);
+ const set<char> set02_ref(title02, title02 + N2);
+ const set<char> set03_ref(title03, title03 + N3);
+ const set<char> set04_ref(title04, title04 + N4);
+
+ my_set::size_type size01, size02;
+
+ my_alloc alloc01(1);
+
+ my_set set01(less<char>(), alloc01);
+ size01 = set01.size();
+ my_set set02(less<char>(), alloc01);
+ size02 = set02.size();
+
+ set01.swap(set02);
+ VERIFY( set01.size() == size02 );
+ VERIFY( set01.empty() );
+ VERIFY( set02.size() == size01 );
+ VERIFY( set02.empty() );
+
+ my_set set03(less<char>(), alloc01);
+ size01 = set03.size();
+ my_set set04(title02, title02 + N2, less<char>(), alloc01);
+ size02 = set04.size();
+
+ set03.swap(set04);
+ VERIFY( set03.size() == size02 );
+ VERIFY( equal(set03.begin(), set03.end(), set02_ref.begin()) );
+ VERIFY( set04.size() == size01 );
+ VERIFY( set04.empty() );
+
+ my_set set05(title01, title01 + N1, less<char>(), alloc01);
+ size01 = set05.size();
+ my_set set06(title02, title02 + N2, less<char>(), alloc01);
+ size02 = set06.size();
+
+ set05.swap(set06);
+ VERIFY( set05.size() == size02 );
+ VERIFY( equal(set05.begin(), set05.end(), set02_ref.begin()) );
+ VERIFY( set06.size() == size01 );
+ VERIFY( equal(set06.begin(), set06.end(), set01_ref.begin()) );
+
+ my_set set07(title01, title01 + N1, less<char>(), alloc01);
+ size01 = set07.size();
+ my_set set08(title03, title03 + N3, less<char>(), alloc01);
+ size02 = set08.size();
+
+ set07.swap(set08);
+ VERIFY( set07.size() == size02 );
+ VERIFY( equal(set07.begin(), set07.end(), set03_ref.begin()) );
+ VERIFY( set08.size() == size01 );
+ VERIFY( equal(set08.begin(), set08.end(), set01_ref.begin()) );
+
+ my_set set09(title03, title03 + N3, less<char>(), alloc01);
+ size01 = set09.size();
+ my_set set10(title04, title04 + N4, less<char>(), alloc01);
+ size02 = set10.size();
+
+ set09.swap(set10);
+ VERIFY( set09.size() == size02 );
+ VERIFY( equal(set09.begin(), set09.end(), set04_ref.begin()) );
+ VERIFY( set10.size() == size01 );
+ VERIFY( equal(set10.begin(), set10.end(), set03_ref.begin()) );
+
+ my_set set11(title04, title04 + N4, less<char>(), alloc01);
+ size01 = set11.size();
+ my_set set12(title01, title01 + N1, less<char>(), alloc01);
+ size02 = set12.size();
+
+ set11.swap(set12);
+ VERIFY( set11.size() == size02 );
+ VERIFY( equal(set11.begin(), set11.end(), set01_ref.begin()) );
+ VERIFY( set12.size() == size01 );
+ VERIFY( equal(set12.begin(), set12.end(), set04_ref.begin()) );
+
+ my_set set13(title03, title03 + N3, less<char>(), alloc01);
+ size01 = set13.size();
+ my_set set14(title03, title03 + N3, less<char>(), alloc01);
+ size02 = set14.size();
+
+ set13.swap(set14);
+ VERIFY( set13.size() == size02 );
+ VERIFY( equal(set13.begin(), set13.end(), set03_ref.begin()) );
+ VERIFY( set14.size() == size01 );
+ VERIFY( equal(set14.begin(), set14.end(), set03_ref.begin()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/3.cc
new file mode 100644
index 000000000..5f192293d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap/3.cc
@@ -0,0 +1,166 @@
+// 2005-12-20 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.3.3 set::swap
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator, two different personalities.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef __gnu_test::uneq_allocator<char> my_alloc;
+ typedef set<char, less<char>, my_alloc> my_set;
+
+ const char title01[] = "Rivers of sand";
+ const char title02[] = "Concret PH";
+ const char title03[] = "Sonatas and Interludes for Prepared Piano";
+ const char title04[] = "never as tired as when i'm waking up";
+
+ const size_t N1 = sizeof(title01);
+ const size_t N2 = sizeof(title02);
+ const size_t N3 = sizeof(title03);
+ const size_t N4 = sizeof(title04);
+
+ const set<char> set01_ref(title01, title01 + N1);
+ const set<char> set02_ref(title02, title02 + N2);
+ const set<char> set03_ref(title03, title03 + N3);
+ const set<char> set04_ref(title04, title04 + N4);
+
+ my_set::size_type size01, size02;
+
+ my_alloc alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ my_set set01(less<char>(), alloc01);
+ size01 = set01.size();
+ personality01 = set01.get_allocator().get_personality();
+ my_set set02(less<char>(), alloc02);
+ size02 = set02.size();
+ personality02 = set02.get_allocator().get_personality();
+
+ set01.swap(set02);
+ VERIFY( set01.size() == size02 );
+ VERIFY( set01.empty() );
+ VERIFY( set02.size() == size01 );
+ VERIFY( set02.empty() );
+ VERIFY( set01.get_allocator().get_personality() == personality02 );
+ VERIFY( set02.get_allocator().get_personality() == personality01 );
+
+ my_set set03(less<char>(), alloc02);
+ size01 = set03.size();
+ personality01 = set03.get_allocator().get_personality();
+ my_set set04(title02, title02 + N2, less<char>(), alloc01);
+ size02 = set04.size();
+ personality02 = set04.get_allocator().get_personality();
+
+ set03.swap(set04);
+ VERIFY( set03.size() == size02 );
+ VERIFY( equal(set03.begin(), set03.end(), set02_ref.begin()) );
+ VERIFY( set04.size() == size01 );
+ VERIFY( set04.empty() );
+ VERIFY( set03.get_allocator().get_personality() == personality02 );
+ VERIFY( set04.get_allocator().get_personality() == personality01 );
+
+ my_set set05(title01, title01 + N1, less<char>(), alloc01);
+ size01 = set05.size();
+ personality01 = set05.get_allocator().get_personality();
+ my_set set06(title02, title02 + N2, less<char>(), alloc02);
+ size02 = set06.size();
+ personality02 = set06.get_allocator().get_personality();
+
+ set05.swap(set06);
+ VERIFY( set05.size() == size02 );
+ VERIFY( equal(set05.begin(), set05.end(), set02_ref.begin()) );
+ VERIFY( set06.size() == size01 );
+ VERIFY( equal(set06.begin(), set06.end(), set01_ref.begin()) );
+ VERIFY( set05.get_allocator().get_personality() == personality02 );
+ VERIFY( set06.get_allocator().get_personality() == personality01 );
+
+ my_set set07(title01, title01 + N1, less<char>(), alloc02);
+ size01 = set07.size();
+ personality01 = set07.get_allocator().get_personality();
+ my_set set08(title03, title03 + N3, less<char>(), alloc01);
+ size02 = set08.size();
+ personality02 = set08.get_allocator().get_personality();
+
+ set07.swap(set08);
+ VERIFY( set07.size() == size02 );
+ VERIFY( equal(set07.begin(), set07.end(), set03_ref.begin()) );
+ VERIFY( set08.size() == size01 );
+ VERIFY( equal(set08.begin(), set08.end(), set01_ref.begin()) );
+ VERIFY( set07.get_allocator().get_personality() == personality02 );
+ VERIFY( set08.get_allocator().get_personality() == personality01 );
+
+ my_set set09(title03, title03 + N3, less<char>(), alloc01);
+ size01 = set09.size();
+ personality01 = set09.get_allocator().get_personality();
+ my_set set10(title04, title04 + N4, less<char>(), alloc02);
+ size02 = set10.size();
+ personality02 = set10.get_allocator().get_personality();
+
+ set09.swap(set10);
+ VERIFY( set09.size() == size02 );
+ VERIFY( equal(set09.begin(), set09.end(), set04_ref.begin()) );
+ VERIFY( set10.size() == size01 );
+ VERIFY( equal(set10.begin(), set10.end(), set03_ref.begin()) );
+ VERIFY( set09.get_allocator().get_personality() == personality02 );
+ VERIFY( set10.get_allocator().get_personality() == personality01 );
+
+ my_set set11(title04, title04 + N4, less<char>(), alloc02);
+ size01 = set11.size();
+ personality01 = set11.get_allocator().get_personality();
+ my_set set12(title01, title01 + N1, less<char>(), alloc01);
+ size02 = set12.size();
+ personality02 = set12.get_allocator().get_personality();
+
+ set11.swap(set12);
+ VERIFY( set11.size() == size02 );
+ VERIFY( equal(set11.begin(), set11.end(), set01_ref.begin()) );
+ VERIFY( set12.size() == size01 );
+ VERIFY( equal(set12.begin(), set12.end(), set04_ref.begin()) );
+ VERIFY( set11.get_allocator().get_personality() == personality02 );
+ VERIFY( set12.get_allocator().get_personality() == personality01 );
+
+ my_set set13(title03, title03 + N3, less<char>(), alloc01);
+ size01 = set13.size();
+ personality01 = set13.get_allocator().get_personality();
+ my_set set14(title03, title03 + N3, less<char>(), alloc02);
+ size02 = set14.size();
+ personality02 = set14.get_allocator().get_personality();
+
+ set13.swap(set14);
+ VERIFY( set13.size() == size02 );
+ VERIFY( equal(set13.begin(), set13.end(), set03_ref.begin()) );
+ VERIFY( set14.size() == size01 );
+ VERIFY( equal(set14.begin(), set14.end(), set03_ref.begin()) );
+ VERIFY( set13.get_allocator().get_personality() == personality02 );
+ VERIFY( set14.get_allocator().get_personality() == personality01 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/operations/1.cc b/libstdc++-v3/testsuite/23_containers/set/operations/1.cc
new file mode 100644
index 000000000..7b828930a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/operations/1.cc
@@ -0,0 +1,126 @@
+// 2006-11-25 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// A few tests for equal_range, in the occasion of libstdc++/29385.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ set<int> s0;
+ typedef set<int>::iterator iterator;
+ typedef pair<iterator, bool> insert_return_type;
+ pair<iterator, iterator> pp0;
+
+ pp0 = s0.equal_range(1);
+ VERIFY( s0.count(1) == 0 );
+ VERIFY( pp0.first == s0.end() );
+ VERIFY( pp0.second == s0.end() );
+
+ insert_return_type irt0 = s0.insert(1);
+ insert_return_type irt1 = s0.insert(2);
+ insert_return_type irt2 = s0.insert(3);
+
+ pp0 = s0.equal_range(2);
+ VERIFY( s0.count(2) == 1 );
+ VERIFY( *pp0.first == 2 );
+ VERIFY( *pp0.second == 3 );
+ VERIFY( pp0.first == irt1.first );
+ VERIFY( --pp0.first == irt0.first );
+ VERIFY( pp0.second == irt2.first );
+
+ s0.insert(3);
+ insert_return_type irt3 = s0.insert(3);
+ insert_return_type irt4 = s0.insert(4);
+
+ pp0 = s0.equal_range(3);
+ VERIFY( s0.count(3) == 1 );
+ VERIFY( *pp0.first == 3 );
+ VERIFY( *pp0.second == 4 );
+ VERIFY( pp0.first == irt2.first );
+ VERIFY( --pp0.first == irt1.first );
+ VERIFY( pp0.second == irt4.first );
+
+ insert_return_type irt5 = s0.insert(0);
+ s0.insert(1);
+ s0.insert(1);
+ s0.insert(1);
+
+ pp0 = s0.equal_range(1);
+ VERIFY( s0.count(1) == 1 );
+ VERIFY( *pp0.first == 1 );
+ VERIFY( *pp0.second == 2 );
+ VERIFY( pp0.first == irt0.first );
+ VERIFY( --pp0.first == irt5.first );
+ VERIFY( pp0.second == irt1.first );
+
+ insert_return_type irt6 = s0.insert(5);
+ s0.insert(5);
+ s0.insert(5);
+
+ pp0 = s0.equal_range(5);
+ VERIFY( s0.count(5) == 1 );
+ VERIFY( *pp0.first == 5 );
+ VERIFY( pp0.first == irt6.first );
+ VERIFY( --pp0.first == irt4.first );
+ VERIFY( pp0.second == s0.end() );
+
+ s0.insert(4);
+ s0.insert(4);
+ s0.insert(4);
+
+ pp0 = s0.equal_range(4);
+ VERIFY( s0.count(4) == 1 );
+ VERIFY( *pp0.first == 4 );
+ VERIFY( *pp0.second == 5 );
+ VERIFY( pp0.first == irt4.first );
+ VERIFY( --pp0.first == irt3.first );
+ VERIFY( pp0.second == irt6.first );
+
+ s0.insert(0);
+ insert_return_type irt7 = s0.insert(0);
+ s0.insert(1);
+
+ pp0 = s0.equal_range(0);
+ VERIFY( s0.count(0) == 1 );
+ VERIFY( *pp0.first == 0 );
+ VERIFY( *pp0.second == 1 );
+ VERIFY( pp0.first == irt5.first );
+ VERIFY( pp0.first == s0.begin() );
+ VERIFY( pp0.second == irt0.first );
+
+ pp0 = s0.equal_range(1);
+ VERIFY( s0.count(1) == 1 );
+ VERIFY( *pp0.first == 1 );
+ VERIFY( *pp0.second == 2 );
+ VERIFY( pp0.first == irt0.first );
+ VERIFY( --pp0.first == irt7.first );
+ VERIFY( pp0.second == irt1.first );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc
new file mode 100644
index 000000000..babd6db2b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.3.4 template class multiset negative tests
+// 2000-09-07 bgarcia@laurelnetworks.com
+
+#include <set>
+#include <string>
+
+// libstdc++/86: map & set iterator comparisons are not type-safe
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::set<unsigned int> setByIndex;
+ std::set<std::string> setByName;
+
+ std::set<unsigned int>::iterator itr(setByIndex.begin());
+
+ // NB: it's not setByIndex!!
+ test &= itr != setByName.end(); // { dg-error "no" }
+ test &= itr == setByName.end(); // { dg-error "no" }
+}
+
+// { dg-excess-errors "" }
diff --git a/libstdc++-v3/testsuite/23_containers/set/range_access.cc b/libstdc++-v3/testsuite/23_containers/set/range_access.cc
new file mode 100644
index 000000000..b1c33b773
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/range_access.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <set>
+
+void
+test01()
+{
+ std::set<int> s{1, 2, 3};
+ std::begin(s);
+ std::end(s);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc
new file mode 100644
index 000000000..20dd8b9f1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-15 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <set>
+#include <testsuite_containers.h>
+
+int main()
+{
+ typedef std::set<int> test_type;
+ __gnu_test::citerator<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc
new file mode 100644
index 000000000..d9146e30c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/basic.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-11-30 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <set>
+#include <exception/safety.h>
+
+void
+value()
+{
+ typedef __gnu_cxx::throw_value_limit value_type;
+ typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+ typedef std::less<value_type> compare_type;
+ typedef std::set<value_type, compare_type, allocator_type> test_type;
+ __gnu_test::basic_safety<test_type> test;
+}
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ value();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/generation_prohibited.cc
new file mode 100644
index 000000000..0536b99ac
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/generation_prohibited.cc
@@ -0,0 +1,35 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <set>
+#include <exception/safety.h>
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ typedef __gnu_cxx::throw_value_random value_type;
+ typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+ typedef std::less<value_type> compare_type;
+ typedef std::set<value_type, compare_type, allocator_type> test_type;
+ __gnu_test::generation_prohibited<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/propagation_consistent.cc
new file mode 100644
index 000000000..dccfd3a5f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/exception/propagation_consistent.cc
@@ -0,0 +1,35 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-09-09 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <set>
+#include <exception/safety.h>
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ typedef __gnu_cxx::throw_value_limit value_type;
+ typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+ typedef std::less<value_type> compare_type;
+ typedef std::set<value_type, compare_type, allocator_type> test_type;
+ __gnu_test::propagation_consistent<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000..0b8550590
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// This file tests explicit instantiation of library containers
+
+#include <set>
+
+// { dg-do compile }
+
+template class std::set<int>;
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1_c++0x.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1_c++0x.cc
new file mode 100644
index 000000000..e957decf0
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/1_c++0x.cc
@@ -0,0 +1,25 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// This file tests explicit instantiation of library containers
+
+#include <set>
+
+template class std::set<int>;
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc
new file mode 100644
index 000000000..181e9ce6a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc
@@ -0,0 +1,27 @@
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// This file tests explicit instantiation of library containers
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+// { dg-do compile }
+
+template class std::set<__gnu_test::NonDefaultConstructible>;
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/3.cc
new file mode 100644
index 000000000..1cc37c731
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/3.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// This file tests explicit instantiation of library containers
+
+#include <set>
+
+// { dg-do compile }
+
+// libstdc++/21770
+template class std::set<int, std::less<int>, std::allocator<char> >;
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc
new file mode 100644
index 000000000..2bbe97667
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,29 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+
+// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// This file tests explicit instantiation of library containers
+
+#include <set>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+// { dg-do compile }
+
+// libstdc++/41792
+template class std::set<__gnu_test::OverloadedAddress>;
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/partial_specialization/1.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/partial_specialization/1.cc
new file mode 100644
index 000000000..d57aec669
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/partial_specialization/1.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// This file tests user specialization of library containers
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+struct user_type {};
+
+namespace std
+{
+ template<typename Allocator>
+ class set<user_type, Allocator> {};
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc
new file mode 100644
index 000000000..0581e49ec
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/requirements/typedefs.cc
@@ -0,0 +1,25 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_containers.h>
+#include <set>
+
+// Check container for required typedefs.
+__gnu_test::types<std::set<int> > t;