summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/list
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/list')
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/14340.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/18604.cc42
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/23781_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/1.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/1.h61
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc44
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.h79
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/1.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/1.h63
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/2.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/2.h77
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/3.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/3.h48
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/4.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/4.h61
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/5.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/5.h51
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/6.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/6.h64
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/7.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/7.h65
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/8.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/8.h51
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/9.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/9.h59
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.h78
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/moveable.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/moveable.h41
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/assign1_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/assign2_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/assign3_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/assign4_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/construct1_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/construct2_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/construct3_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/construct4_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/insert1_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/insert2_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/insert3_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/insert4_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/invalidation/1.cc59
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/invalidation/2.cc55
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/invalidation/3.cc77
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/debug/invalidation/4.cc55
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/init-list.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/init-list.h65
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/1.h116
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/1_c++0x.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/2.h89
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/3.h121
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.h90
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.h58
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.h127
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.h156
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/1.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/1.h68
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/2.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/2.h54
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/2_c++0x.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/3.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/3.h68
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/35969.cc79
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/3_c++0x.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/4.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/4.h92
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/42352.cc66
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/5.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/5.h134
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/pthread1.cc131
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/pthread5.cc125
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/range_access.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc28
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/exception/basic.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/exception/generation_prohibited.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/exception/propagation_consistent.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/1.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/1_c++0x.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/2.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/3.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/4.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/typedefs.cc25
98 files changed, 4619 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/list/14340.cc b/libstdc++-v3/testsuite/23_containers/list/14340.cc
new file mode 100644
index 000000000..5606ff042
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+
+// NB: This issue affected only debug-mode.
+
+// { dg-do compile }
+
+// libstdc++/14340
+int main()
+{
+ typedef std::list<int> list_type;
+ __gnu_test::conversion<list_type>::iterator_to_const_iterator();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/18604.cc b/libstdc++-v3/testsuite/23_containers/list/18604.cc
new file mode 100644
index 000000000..398d0f6cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/18604.cc
@@ -0,0 +1,42 @@
+// 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 <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/23781_neg.cc b/libstdc++-v3/testsuite/23_containers/list/23781_neg.cc
new file mode 100644
index 000000000..7b291df79
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/23781_neg.cc
@@ -0,0 +1,29 @@
+// 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 <list>
+#include <cstddef>
+
+typedef std::list<int> list_type;
+list_type::iterator it = NULL; // { dg-error "conversion" }
+list_type::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc
new file mode 100644
index 000000000..3b0e8dc72
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "1.h"
+#include <list>
+
+int
+main()
+{
+ capacity01<std::list<int> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/1.h b/libstdc++-v3/testsuite/23_containers/list/capacity/1.h
new file mode 100644
index 000000000..408e0786c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/1.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.2 list capacity [lib.list.capacity]
+
+#include <testsuite_hooks.h>
+
+// This test verifies the following.
+//
+// 23.2.2 bool empty() const
+// 23.2.2 size_type size() const
+// 23.2.2 iterator begin()
+// 23.2.2 iterator end()
+// 23.2.2.3 void push_back(const T&)
+// 23.2.2 size_type max_size() const
+// 23.2.2.2 void resize(size_type s, T c = T())
+//
+template<typename _Tp>
+void
+capacity01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator_type;
+
+ list_type list0101;
+ VERIFY(list0101.empty());
+ VERIFY(list0101.size() == 0);
+
+ list0101.push_back(1);
+ VERIFY(!list0101.empty());
+ VERIFY(list0101.size() == 1);
+
+ list0101.resize(3, 2);
+ VERIFY(!list0101.empty());
+ VERIFY(list0101.size() == 3);
+
+ iterator_type i = list0101.begin();
+ VERIFY(*i == 1); ++i;
+ VERIFY(*i == 2); ++i;
+ VERIFY(*i == 2); ++i;
+ VERIFY(i == list0101.end());
+
+ list0101.resize(0);
+ VERIFY(list0101.empty());
+ VERIFY(list0101.size() == 0);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc
new file mode 100644
index 000000000..d8c88b526
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc
@@ -0,0 +1,44 @@
+// 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.2.2.2 list capacity [lib.list.capacity]
+
+#include <list>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::list<int> list_type;
+ list_type l;
+
+#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE
+ using std::_List_node;
+#else
+ using std::_GLIBCXX_STD_C::_List_node;
+#endif
+
+ VERIFY( l.max_size() == std::allocator<_List_node<int> >().max_size() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc
new file mode 100644
index 000000000..06424c0a8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 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 <list>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::list<__gnu_test::NonCopyConstructible> l;
+ VERIFY( std::distance(l.begin(), l.end()) == 0 );
+
+ l.resize(1000);
+ VERIFY( std::distance(l.begin(), l.end()) == 1000 );
+ for(auto it = l.begin(); it != l.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc
new file mode 100644
index 000000000..31dacb592
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc
@@ -0,0 +1,29 @@
+// 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 "check_construct_destroy.h"
+#include <list>
+
+int main()
+{
+ typedef __gnu_test::tracker_allocator<int> allocator_type;
+ construct_destroy<std::list<int, allocator_type> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.h b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.h
new file mode 100644
index 000000000..14da42dc8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.h
@@ -0,0 +1,79 @@
+// 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 <iterator>
+#include <testsuite_allocator.h>
+
+template<typename _Tp>
+bool
+construct_destroy()
+{
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator_type;
+
+ using namespace __gnu_test;
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ list_type c;
+ ok = check_construct_destroy("empty container", 0, 0) && ok;
+ }
+ ok = check_construct_destroy("empty container", 0, 0) && ok;
+
+
+ tracker_allocator_counter::reset();
+ {
+ list_type c(arr10, arr10 + 10);
+ ok = check_construct_destroy("Construct from range", 10, 0) && ok;
+ }
+ ok = check_construct_destroy("Construct from range", 10, 10) && ok;
+
+ {
+ list_type c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ c.insert(c.begin(), arr10[0]);
+ ok = check_construct_destroy("Insert element", 1, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert element", 1, 11) && ok;
+
+ {
+ list_type c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ iterator_type i5 = c.begin();
+ std::advance(i5, 5);
+ c.insert(i5, arr10, arr10+3);
+ ok = check_construct_destroy("Insert short range", 3, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert short range", 3, 13) && ok;
+
+ {
+ list_type c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ iterator_type i7 = c.begin();
+ std::advance(i7, 5);
+ c.insert(i7, arr10, arr10+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/list/cons/1.cc b/libstdc++-v3/testsuite/23_containers/list/cons/1.cc
new file mode 100644
index 000000000..da469ebb1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/1.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2001, 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/>.
+
+#include "1.h"
+#include <list>
+
+int main()
+{
+ cons01<std::list< A<B> > >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/1.h b/libstdc++-v3/testsuite/23_containers/list/cons/1.h
new file mode 100644
index 000000000..2aa48be91
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/1.h
@@ -0,0 +1,63 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// A nontrivial type.
+template<typename T>
+ struct A { };
+
+// Another nontrivial type
+struct B { };
+
+// Default constructor, basic properties
+//
+// This test verifies the following.
+// 23.2.2.1 explicit list(const a& = Allocator())
+// 23.1 (7) iterator behaviour of empty containers
+// 23.2.2 iterator begin()
+// 23.2.2 iterator end()
+// 23.2.2 size_type size() const
+// 23.2.2 existence of required typedefs
+//
+template<typename _Tp>
+void
+cons01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ list_type list0101;
+ VERIFY(list0101.begin() == list0101.end());
+ VERIFY(list0101.size() == 0);
+
+ // check type definitions -- will fail compile if missing
+ typedef typename list_type::reference reference;
+ typedef typename list_type::const_reference const_reference;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::const_iterator const_iterator;
+ typedef typename list_type::size_type size_type;
+ typedef typename list_type::difference_type difference_type;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::pointer pointer;
+ typedef typename list_type::const_pointer const_pointer;
+ typedef typename list_type::reverse_iterator reverse_iterator;
+ typedef typename list_type::const_reverse_iterator const_reverse_iterator;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/2.cc b/libstdc++-v3/testsuite/23_containers/list/cons/2.cc
new file mode 100644
index 000000000..86c59f383
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/2.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "2.h"
+#include <list>
+
+int main()
+{
+ cons021<std::list<int> >();
+ cons022<std::list< A<B> > >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/2.h b/libstdc++-v3/testsuite/23_containers/list/cons/2.h
new file mode 100644
index 000000000..eb32896e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/2.h
@@ -0,0 +1,77 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// A nontrivial type.
+template<typename T>
+ struct A { };
+
+// Another nontrivial type
+struct B { };
+
+// Fill constructor
+//
+// This test verifies the following.
+// 23.2.2.1 explicit list(size_type n, const T& v = T(), const a& = Allocator())
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons021()
+{
+ bool test __attribute__((unused)) = true;
+ const std::size_t LIST_SIZE = 5;
+ const int INIT_VALUE = 7;
+ std::size_t count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ // default value
+ list_type list0202(LIST_SIZE);
+ for (i = list0202.begin(), count = 0;
+ i != list0202.end();
+ ++i, ++count)
+ VERIFY(*i == 0);
+ VERIFY(count == LIST_SIZE);
+ VERIFY(list0202.size() == LIST_SIZE);
+
+ // explicit value
+ list_type list0203(LIST_SIZE, INIT_VALUE);
+ for (i = list0203.begin(), count = 0;
+ i != list0203.end();
+ ++i, ++count)
+ VERIFY(*i == INIT_VALUE);
+ VERIFY(count == LIST_SIZE);
+ VERIFY(list0203.size() == LIST_SIZE);
+}
+
+template<typename _Tp>
+void
+cons022()
+{
+ // nontrivial value_type
+ typedef _Tp list_type;
+ const std::size_t LIST_SIZE = 5;
+ list_type list0201(LIST_SIZE);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/3.cc b/libstdc++-v3/testsuite/23_containers/list/cons/3.cc
new file mode 100644
index 000000000..f373cc05d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/3.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2001, 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/>.
+
+#include "3.h"
+#include <list>
+
+int main()
+{
+ cons03<std::list<C> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/3.h b/libstdc++-v3/testsuite/23_containers/list/cons/3.h
new file mode 100644
index 000000000..983c24ca8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/3.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// A nontrivial type convertible from an int
+struct C
+{
+ C(int i) : i_(i) { }
+ bool operator==(const C& rhs) { return i_ == rhs.i_; }
+ int i_;
+};
+
+// Fill constructor disguised as a range constructor
+template<typename _Tp>
+void
+cons03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const std::size_t LIST_SIZE = 5;
+ const int INIT_VALUE = 7;
+ std::size_t count = 0;
+ list_type list0204(LIST_SIZE, INIT_VALUE);
+ iterator i = list0204.begin();
+ for (; i != list0204.end(); ++i, ++count)
+ VERIFY(*i == INIT_VALUE);
+ VERIFY(count == LIST_SIZE);
+ VERIFY(list0204.size() == LIST_SIZE);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/4.cc b/libstdc++-v3/testsuite/23_containers/list/cons/4.cc
new file mode 100644
index 000000000..d6b58be04
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/4.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "4.h"
+#include <list>
+
+int main()
+{
+ cons04<std::list<int> >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/4.h b/libstdc++-v3/testsuite/23_containers/list/cons/4.h
new file mode 100644
index 000000000..bf2e51c13
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/4.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Range constructor
+//
+// This test verifies the following.
+// 23.2.2.1 template list(InputIterator f, InputIterator l,
+// const Allocator& a = Allocator())
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons04()
+{
+ bool test __attribute__((unused)) = true;
+ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ std::size_t count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ // construct from a dissimilar range
+ list_type list0301(A, A + N);
+ for (i = list0301.begin(), count = 0;
+ i != list0301.end();
+ ++i, ++count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == N);
+ VERIFY(list0301.size() == N);
+
+ // construct from a similar range
+ list_type list0302(list0301.begin(), list0301.end());
+ for (i = list0302.begin(), count = 0;
+ i != list0302.end();
+ ++i, ++count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == N);
+ VERIFY(list0302.size() == N);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/5.cc b/libstdc++-v3/testsuite/23_containers/list/cons/5.cc
new file mode 100644
index 000000000..de86dccd6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/5.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "5.h"
+#include <list>
+
+int main()
+{
+ cons05<std::list<int> >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/5.h b/libstdc++-v3/testsuite/23_containers/list/cons/5.h
new file mode 100644
index 000000000..5c273a322
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/5.h
@@ -0,0 +1,51 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Copy constructor
+//
+// This test verifies the following.
+// 23.2.2.1 list(const list& x)
+// 23.2.2 reverse_iterator rbegin()
+// 23.2.2 reverse_iterator rend()
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons05()
+{
+ bool test __attribute__((unused)) = true;
+ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ int count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::reverse_iterator reverse_iterator;
+ reverse_iterator i;
+ list_type list0401(A, A + N);
+
+ list_type list0402(list0401);
+ for (i = list0401.rbegin(), count = N - 1;
+ i != list0401.rend();
+ ++i, --count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == -1);
+ VERIFY(list0401.size() == N);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/6.cc b/libstdc++-v3/testsuite/23_containers/list/cons/6.cc
new file mode 100644
index 000000000..c1a2baedc
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/6.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "6.h"
+#include <list>
+
+int main()
+{
+ cons06<std::list<int> >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/6.h b/libstdc++-v3/testsuite/23_containers/list/cons/6.h
new file mode 100644
index 000000000..b247e5563
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/6.h
@@ -0,0 +1,64 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Range assign
+//
+// This test verifies the following.
+// 23.2.2.1 void assign(InputIterator f, InputIterator l)
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons06()
+{
+ bool test __attribute__((unused)) = true;
+ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+ const int B[] = {101, 102, 103, 104, 105};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ const std::size_t M = sizeof(B) / sizeof(int);
+ std::size_t count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ list_type list0501;
+
+ // make it bigger
+ list0501.assign(A, A + N);
+ for (i = list0501.begin(), count = 0;
+ i != list0501.end();
+ ++i, ++count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == N);
+ VERIFY(list0501.size() == N);
+
+ // make it smaller
+ list0501.assign(B, B + M);
+ for (i = list0501.begin(), count = 0;
+ i != list0501.end();
+ ++i, ++count)
+ VERIFY(*i == B[count]);
+ VERIFY(count == M);
+ VERIFY(list0501.size() == M);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/7.cc b/libstdc++-v3/testsuite/23_containers/list/cons/7.cc
new file mode 100644
index 000000000..0f3de3c67
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/7.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "7.h"
+#include <list>
+
+int main()
+{
+ cons07<std::list<int> >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/7.h b/libstdc++-v3/testsuite/23_containers/list/cons/7.h
new file mode 100644
index 000000000..1ebd7a5cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/7.h
@@ -0,0 +1,65 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Fill assign
+//
+// This test verifies the following.
+// 23.2.2.1 void assign(size_type n, const T& v)
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons07()
+{
+ bool test __attribute__((unused)) = true;
+ const std::size_t BIG_LIST_SIZE = 11;
+ const int BIG_INIT_VALUE = 7;
+ const std::size_t SMALL_LIST_SIZE = 5;
+ const int SMALL_INIT_VALUE = 17;
+ std::size_t count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ list_type list0601;
+ VERIFY(list0601.size() == 0);
+
+ // make it bigger
+ list0601.assign(BIG_LIST_SIZE, BIG_INIT_VALUE);
+ for (i = list0601.begin(), count = 0;
+ i != list0601.end();
+ ++i, ++count)
+ VERIFY(*i == BIG_INIT_VALUE);
+ VERIFY(count == BIG_LIST_SIZE);
+ VERIFY(list0601.size() == BIG_LIST_SIZE);
+
+ // make it shrink
+ list0601.assign(SMALL_LIST_SIZE, SMALL_INIT_VALUE);
+ for (i = list0601.begin(), count = 0;
+ i != list0601.end();
+ ++i, ++count)
+ VERIFY(*i == SMALL_INIT_VALUE);
+ VERIFY(count == SMALL_LIST_SIZE);
+ VERIFY(list0601.size() == SMALL_LIST_SIZE);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/8.cc b/libstdc++-v3/testsuite/23_containers/list/cons/8.cc
new file mode 100644
index 000000000..16d888b44
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/8.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "8.h"
+#include <list>
+
+int main()
+{
+ cons08<std::list<C> >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/8.h b/libstdc++-v3/testsuite/23_containers/list/cons/8.h
new file mode 100644
index 000000000..4aed16b81
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/8.h
@@ -0,0 +1,51 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// A nontrivial type convertible from an int
+struct C
+{
+ C(int i) : i_(i) { }
+ bool operator==(const C& rhs) { return i_ == rhs.i_; }
+ int i_;
+};
+
+// Fill Assignment disguised as a Range Assignment
+template<typename _Tp>
+void
+cons08()
+{
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ bool test __attribute__((unused)) = true;
+ const std::size_t LIST_SIZE = 5;
+ const int INIT_VALUE = 7;
+ std::size_t count = 0;
+
+ list_type list0604;
+ VERIFY(list0604.size() == 0);
+
+ list0604.assign(LIST_SIZE, INIT_VALUE);
+ iterator i = list0604.begin();
+ for (; i != list0604.end(); ++i, ++count)
+ VERIFY(*i == INIT_VALUE);
+ VERIFY(count == LIST_SIZE);
+ VERIFY(list0604.size() == LIST_SIZE);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/9.cc b/libstdc++-v3/testsuite/23_containers/list/cons/9.cc
new file mode 100644
index 000000000..908454453
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/9.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2001, 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/>.
+
+#include "9.h"
+#include <list>
+
+int main()
+{
+ cons09<std::list<int> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/9.h b/libstdc++-v3/testsuite/23_containers/list/cons/9.h
new file mode 100644
index 000000000..90c3fd054
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/9.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Assignment operator
+//
+// This test verifies the following.
+// 23.2.2 operator=(const list& x)
+// 23.2.2 iterator begin()
+// 23.2.2 iterator end()
+// 23.2.2 size_type size() const
+// 23.2.2 bool operator==(const list& x, const list& y)
+//
+template<typename _Tp>
+void
+cons09()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int A[] = {701, 702, 703, 704, 705};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ std::size_t count;
+
+ iterator i;
+
+ list_type list0701(A, A + N);
+ VERIFY(list0701.size() == N);
+
+ list_type list0702;
+ VERIFY(list0702.size() == 0);
+
+ list0702 = list0701;
+ VERIFY(list0702.size() == N);
+ for (i = list0702.begin(), count = 0;
+ i != list0702.end();
+ ++i, ++count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == N);
+ VERIFY(list0702 == list0701);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc
new file mode 100644
index 000000000..cb186d321
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.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/>.
+
+#include "clear_allocator.h"
+#include <list>
+
+int main()
+{
+ typedef std::list<int, clear_alloc<int> > list_type;
+ Check_Container<list_type>();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.h b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.h
new file mode 100644
index 000000000..3a53751c9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.h
@@ -0,0 +1,78 @@
+// 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/>.
+
+#include <ext/new_allocator.h>
+
+using namespace std;
+using __gnu_cxx::new_allocator;
+
+template<typename T>
+ class clear_alloc : public new_allocator<T>
+ {
+ public:
+
+ template <typename T1>
+ struct rebind
+ { typedef clear_alloc<T1> other; };
+
+ virtual void clear() throw()
+ { }
+
+ clear_alloc() throw()
+ { }
+
+ clear_alloc(clear_alloc const&) throw() : new_allocator<T>()
+ { }
+
+ template<typename T1>
+ clear_alloc(clear_alloc<T1> const&) throw()
+ { }
+
+ virtual ~clear_alloc() throw()
+ { this->clear(); }
+
+ T* allocate(typename new_allocator<T>::size_type n, const void *hint = 0)
+ {
+ this->clear();
+ return new_allocator<T>::allocate(n, hint);
+ }
+
+ void deallocate(T *ptr, typename new_allocator<T>::size_type n)
+ {
+ this->clear();
+ new_allocator<T>::deallocate(ptr, n);
+ }
+ };
+
+template<typename Container>
+ void Check_Container()
+ {
+ Container* pic = new Container;
+ int x = 230;
+
+ while (x--)
+ {
+ pic->push_back(x);
+ }
+
+ pic->get_allocator();
+
+ // The following has led to infinite recursions or cores.
+ pic->clear();
+
+ delete pic;
+ }
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc
new file mode 100644
index 000000000..f59f520f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-06-18 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 <list>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::list<__gnu_test::NonCopyConstructible> l(1000);
+ VERIFY( std::distance(l.begin(), l.end()) == 1000 );
+ for(auto it = l.begin(); it != l.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/list/cons/moveable.cc
new file mode 100644
index 000000000..fbe06634e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/moveable.cc
@@ -0,0 +1,27 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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 "moveable.h"
+#include <list>
+
+int main()
+{
+ test_moveable<std::list<int> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/moveable.h b/libstdc++-v3/testsuite/23_containers/list/cons/moveable.h
new file mode 100644
index 000000000..1f11d6221
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/moveable.h
@@ -0,0 +1,41 @@
+// 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/>.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on list (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <utility>
+#include <testsuite_hooks.h>
+
+template<typename _Tp>
+ void
+ test_moveable()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp list_type;
+
+ list_type a,b;
+ a.push_back(1);
+ b = std::move(a);
+ VERIFY( b.size() == 1 && *b.begin() == 1 && a.size() == 0 );
+
+ list_type c(std::move(b));
+ VERIFY( c.size() == 1 && *c.begin() == 1 );
+ VERIFY( b.size() == 0 );
+ }
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/assign1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/assign1_neg.cc
new file mode 100644
index 000000000..e7b0e5cfe
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/assign1_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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_assign1<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/assign2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/assign2_neg.cc
new file mode 100644
index 000000000..1bd6c2f90
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/assign2_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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_assign2<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/assign3_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/assign3_neg.cc
new file mode 100644
index 000000000..7a40d3189
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/assign3_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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_assign3<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/assign4_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/assign4_neg.cc
new file mode 100644
index 000000000..bde7b923e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/assign4_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/list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_assign1<__gnu_debug::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/construct1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/construct1_neg.cc
new file mode 100644
index 000000000..cbd045571
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct1<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/construct2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/construct2_neg.cc
new file mode 100644
index 000000000..40fdf43b8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct2<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/construct3_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/construct3_neg.cc
new file mode 100644
index 000000000..5000f5a07
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct3<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/construct4_neg.cc
new file mode 100644
index 000000000..29843ea43
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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/list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct1<__gnu_debug::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/insert1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/insert1_neg.cc
new file mode 100644
index 000000000..aa35b46cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert1<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/insert2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/insert2_neg.cc
new file mode 100644
index 000000000..dc84fdd58
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert2<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/insert3_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/insert3_neg.cc
new file mode 100644
index 000000000..aa4910838
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert3<std::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/list/debug/insert4_neg.cc
new file mode 100644
index 000000000..ade280688
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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/list>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert1<__gnu_debug::list<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/1.cc
new file mode 100644
index 000000000..7198e2402
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/1.cc
@@ -0,0 +1,59 @@
+// List 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/list>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+// Assignment
+void test01()
+{
+ using std::advance;
+
+ bool test __attribute__((unused)) = true;
+
+ typedef __gnu_debug::list<int> list_type;
+ list_type v1;
+ list_type v2;
+
+ v1.push_front(17);
+
+ list_type::iterator start = v1.begin();
+ list_type::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());
+
+ finish = v1.end();
+ v1.assign(v2.begin(), v2.end());
+ VERIFY(!finish._M_dereferenceable() && !finish._M_singular());
+
+ finish = v1.end();
+ v1.assign(17, 42);
+ VERIFY(!finish._M_dereferenceable() && !finish._M_singular());
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/2.cc
new file mode 100644
index 000000000..5872936bb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/2.cc
@@ -0,0 +1,55 @@
+// List 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/list>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+// Resize
+void test02()
+{
+ using std::advance;
+
+ bool test __attribute__((unused)) = true;
+
+ typedef __gnu_debug::list<int> list_type;
+
+ list_type v(10, 17);
+
+ list_type::iterator before = v.begin();
+ advance(before, 6);
+ list_type::iterator at = before;
+ advance(at, 1);
+ list_type::iterator after = at;
+ advance(after, 1);
+ list_type::iterator finish = v.end();
+
+ // Shrink
+ v.resize(7);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+ VERIFY(after._M_singular());
+ VERIFY(!finish._M_singular() && !finish._M_dereferenceable());
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/3.cc b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/3.cc
new file mode 100644
index 000000000..0d4844793
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/3.cc
@@ -0,0 +1,77 @@
+// List 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/list>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+// Erase
+void test03()
+{
+ using std::advance;
+
+ bool test __attribute__((unused)) = true;
+ typedef __gnu_debug::list<int> list_type;
+
+ list_type v(20, 42);
+
+ // Single element erase (middle)
+ list_type::iterator before = v.begin();
+ list_type::iterator at = before;
+ advance(at, 3);
+ list_type::iterator after = at;
+ at = v.erase(at);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_dereferenceable());
+ VERIFY(after._M_singular());
+
+ // Single element erase (end)
+ before = v.begin();
+ at = before;
+ after = at;
+ ++after;
+ at = v.erase(at);
+ VERIFY(before._M_singular());
+ VERIFY(at._M_dereferenceable());
+ VERIFY(after._M_dereferenceable());
+
+ // Multiple element erase
+ before = v.begin();
+ at = before;
+ advance(at, 3);
+ after = at;
+ advance(after, 3);
+ v.erase(at, after);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+
+ // clear()
+ before = v.begin();
+ list_type::iterator finish = v.end();
+ VERIFY(before._M_dereferenceable());
+ v.clear();
+ VERIFY(before._M_singular());
+ VERIFY(!finish._M_singular() && !finish._M_dereferenceable());
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/4.cc b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/4.cc
new file mode 100644
index 000000000..a5c9219a2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/debug/invalidation/4.cc
@@ -0,0 +1,55 @@
+// List 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/list>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+// Splice
+void test04()
+{
+ using std::advance;
+
+ bool test __attribute__((unused)) = true;
+
+ typedef __gnu_debug::list<int> list_type;
+
+ list_type l1(10, 17);
+ list_type l2(10, 42);
+
+ list_type::iterator start2 = l2.begin();
+ list_type::iterator end2 = start2;
+ advance(end2, 5);
+ list_type::iterator after2 = end2;
+ advance(after2, 2);
+
+ l1.splice(l1.begin(), l2, start2, end2);
+ VERIFY(start2._M_dereferenceable());
+ VERIFY(end2._M_dereferenceable());
+ VERIFY(after2._M_dereferenceable());
+ VERIFY(start2._M_attached_to(&l1));
+ VERIFY(end2._M_attached_to(&l2));
+ VERIFY(after2._M_attached_to(&l2));
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/init-list.cc b/libstdc++-v3/testsuite/23_containers/list/init-list.cc
new file mode 100644
index 000000000..db6bc3b69
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/init-list.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include "init-list.h"
+#include <list>
+
+int main()
+{
+ typedef int value_type;
+ typedef __gnu_test::tracker_allocator<int> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+ init_list<list_type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/init-list.h b/libstdc++-v3/testsuite/23_containers/list/init-list.h
new file mode 100644
index 000000000..a391ffdad
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/init-list.h
@@ -0,0 +1,65 @@
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <testsuite_allocator.h>
+
+template<typename _Tp>
+bool
+init_list()
+{
+ using namespace __gnu_test;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ list_type c({ 2, 4, 1 });
+ ok = check_construct_destroy("Construct from init-list", 3, 0) && ok;
+ iterator i = c.begin();
+ ok &= (*i++ == 2);
+ ok &= (*i++ == 4);
+ }
+ ok = check_construct_destroy("Construct from init-list", 3, 3) && ok;
+
+ {
+ list_type c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ iterator i = c.begin();
+ ++i; ++i; ++i; ++i; ++i; ++i; ++i;
+ c.insert(i, { 234, 42, 1 });
+ ok = check_construct_destroy("Insert init-list", 3, 0) && ok;
+ ok &= (*--i == 1);
+ ok &= (*--i == 42);
+ }
+ ok = check_construct_destroy("Insert init-list", 3, 13) && ok;
+
+ {
+ list_type c;
+ tracker_allocator_counter::reset();
+ c = { 13, 0, 42 };
+ ok = check_construct_destroy("Assign init-list", 3, 0) && ok;
+ iterator i = c.begin();
+ ok &= (*i++ == 13);
+ }
+ ok = check_construct_destroy("Assign init-list", 3, 3) && ok;
+
+ return ok ? 0 : 1;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc
new file mode 100644
index 000000000..4d56b154a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2001, 2003, 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/>.
+
+#include "1.h"
+#include <list>
+
+int main()
+{
+ modifiers1<std::list<__gnu_test::copy_tracker> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h
new file mode 100644
index 000000000..2abc063e1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h
@@ -0,0 +1,116 @@
+// Copyright (C) 2001, 2003, 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/>.
+
+// 23.2.2.3 list modifiers [lib.list.modifiers]
+
+#include <testsuite_hooks.h>
+
+// range and fill insert/erase + clear
+// missing: o fill insert disguised as a range insert in all its variants
+// o exception effects
+template<typename _Tp>
+void
+modifiers1()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::value_type value_type;
+
+ using __gnu_test::copy_constructor;
+ using __gnu_test::destructor;
+
+ list_type list0301;
+ value_type::reset();
+
+ // fill insert at beginning of list / empty list
+ list0301.insert(list0301.begin(), 3, value_type(11)); // should be [11 11 11]
+ VERIFY(list0301.size() == 3);
+ VERIFY(copy_constructor::count() == 3);
+
+ // save iterators to verify post-insert validity
+ iterator b = list0301.begin();
+ iterator m = list0301.end(); --m;
+ iterator e = list0301.end();
+
+ // fill insert at end of list
+ value_type::reset();
+ list0301.insert(list0301.end(), 3, value_type(13)); // should be [11 11 11 13 13 13]
+ VERIFY(list0301.size() == 6);
+ VERIFY(copy_constructor::count() == 3);
+ VERIFY(b == list0301.begin() && b->id() == 11);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 11);
+
+ // fill insert in the middle of list
+ ++m;
+ value_type::reset();
+ list0301.insert(m, 3, value_type(12)); // should be [11 11 11 12 12 12 13 13 13]
+ VERIFY(list0301.size() == 9);
+ VERIFY(copy_constructor::count() == 3);
+ VERIFY(b == list0301.begin() && b->id() == 11);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 13);
+
+ // single erase
+ value_type::reset();
+ m = list0301.erase(m); // should be [11 11 11 12 12 12 13 13]
+ VERIFY(list0301.size() == 8);
+ VERIFY(destructor::count() == 1);
+ VERIFY(b == list0301.begin() && b->id() == 11);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 13);
+
+ // range erase
+ value_type::reset();
+ m = list0301.erase(list0301.begin(), m); // should be [13 13]
+ VERIFY(list0301.size() == 2);
+ VERIFY(destructor::count() == 6);
+ VERIFY(m->id() == 13);
+
+ // range fill at beginning
+ const int A[] = {321, 322, 333};
+ const int N = sizeof(A) / sizeof(int);
+ value_type::reset();
+ b = list0301.begin();
+ list0301.insert(b, A, A + N); // should be [321 322 333 13 13]
+ VERIFY(list0301.size() == 5);
+ VERIFY(copy_constructor::count() == 3);
+ VERIFY(m->id() == 13);
+
+ // range fill at end
+ value_type::reset();
+ list0301.insert(e, A, A + N); // should be [321 322 333 13 13 321 322 333]
+ VERIFY(list0301.size() == 8);
+ VERIFY(copy_constructor::count() == 3);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 13);
+
+ // range fill in middle
+ value_type::reset();
+ list0301.insert(m, A, A + N);
+ VERIFY(list0301.size() == 11);
+ VERIFY(copy_constructor::count() == 3);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 13);
+
+ value_type::reset();
+ list0301.clear();
+ VERIFY(list0301.size() == 0);
+ VERIFY(destructor::count() == 11);
+ VERIFY(e == list0301.end());
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1_c++0x.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/1_c++0x.cc
new file mode 100644
index 000000000..dea0d4c44
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1_c++0x.cc
@@ -0,0 +1,27 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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 "1.h"
+#include <list>
+
+int main()
+{
+ modifiers1<std::list<__gnu_test::copy_tracker> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc
new file mode 100644
index 000000000..1879ed2e5
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2001, 2003, 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/>.
+
+#include "2.h"
+#include <list>
+
+int main()
+{
+ modifiers2<std::list<__gnu_test::copy_tracker> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h
new file mode 100644
index 000000000..b25467bdb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h
@@ -0,0 +1,89 @@
+// Copyright (C) 2001, 2003, 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/>.
+
+// 23.2.2.3 list modifiers [lib.list.modifiers]
+
+#include <testsuite_hooks.h>
+
+// general single insert/erase + swap
+template<typename _Tp>
+void
+modifiers2()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::const_iterator const_iterator;
+
+ using __gnu_test::copy_constructor;
+ using __gnu_test::destructor;
+
+ list_type list0201;
+ value_type::reset();
+
+ list0201.insert(list0201.begin(), value_type(1)); // list should be [1]
+ VERIFY(list0201.size() == 1);
+ VERIFY(copy_constructor::count() == 1);
+
+ list0201.insert(list0201.end(), value_type(2)); // list should be [1 2]
+ VERIFY(list0201.size() == 2);
+ VERIFY(copy_constructor::count() == 2);
+
+ iterator i = list0201.begin();
+ const_iterator j = i;
+ VERIFY(i->id() == 1); ++i;
+ VERIFY(i->id() == 2);
+
+ list0201.insert(i, value_type(3)); // list should be [1 3 2]
+ VERIFY(list0201.size() == 3);
+ VERIFY(copy_constructor::count() == 3);
+
+ const_iterator k = i;
+ VERIFY(i->id() == 2); --i;
+ VERIFY(i->id() == 3); --i;
+ VERIFY(i->id() == 1);
+ VERIFY(j->id() == 1);
+
+ ++i; // will point to '3'
+ value_type::reset();
+ list0201.erase(i); // should be [1 2]
+ VERIFY(list0201.size() == 2);
+ VERIFY(destructor::count() == 1);
+ VERIFY(k->id() == 2);
+ VERIFY(j->id() == 1);
+
+ list_type list0202;
+ value_type::reset();
+ VERIFY(list0202.size() == 0);
+ VERIFY(copy_constructor::count() == 0);
+ VERIFY(destructor::count() == 0);
+
+ // member swap
+ list0202.swap(list0201);
+ VERIFY(list0201.size() == 0);
+ VERIFY(list0202.size() == 2);
+ VERIFY(copy_constructor::count() == 0);
+ VERIFY(destructor::count() == 0);
+
+ // specialized swap
+ swap(list0201, list0202);
+ VERIFY(list0201.size() == 2);
+ VERIFY(list0202.size() == 0);
+ VERIFY(copy_constructor::count() == 0);
+ VERIFY(destructor::count() == 0);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc
new file mode 100644
index 000000000..990cf227c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2001, 2003, 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/>.
+
+#include "3.h"
+#include <list>
+
+int main()
+{
+ modifiers3<std::list<__gnu_test::copy_tracker> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h
new file mode 100644
index 000000000..c4017db49
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h
@@ -0,0 +1,121 @@
+// Copyright (C) 2001, 2003, 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/>.
+
+// 23.2.2.3 list modifiers [lib.list.modifiers]
+
+#include <testsuite_hooks.h>
+
+// This test verifies the following.
+//
+// 23.2.2.3 void push_front(const T& x)
+// 23.2.2.3 void push_back(const T& x)
+// 23.2.2.3 (1) iterator and reference non-invalidation
+// 23.2.2.3 (1) exception effects
+// 23.2.2.3 (2) complexity requirements
+//
+// 23.2.2.3 void pop_front()
+// 23.2.2.3 void pop_back()
+// 23.2.2.3 (3) iterator and reference non-invalidation
+// 23.2.2.3 (5) complexity requirements
+//
+// 23.2.2 const_iterator begin() const
+// 23.2.2 iterator end()
+// 23.2.2 const_reverse_iterator rbegin() const
+// 23.2.2 _reference front()
+// 23.2.2 const_reference front() const
+// 23.2.2 reference back()
+// 23.2.2 const_reference back() const
+//
+template<typename _Tp>
+void
+modifiers3()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::const_iterator const_iterator;
+ typedef typename list_type::const_reverse_iterator const_reverse_iterator;
+
+ using __gnu_test::copy_constructor;
+ using __gnu_test::destructor;
+
+ list_type list0101;
+ const_iterator i;
+ const_reverse_iterator j;
+ iterator k;
+ value_type::reset();
+
+ list0101.push_back(value_type(1)); // list should be [1]
+ VERIFY(list0101.size() == 1);
+ VERIFY(copy_constructor::count() == 1);
+
+ k = list0101.end();
+ --k;
+ VERIFY(k->id() == 1);
+ VERIFY(k->id() == list0101.front().id());
+ VERIFY(k->id() == list0101.back().id());
+
+ list0101.push_front(value_type(2)); // list should be [2 1]
+ VERIFY(list0101.size() == 2);
+ VERIFY(copy_constructor::count() == 2);
+ VERIFY(k->id() == 1);
+
+ list0101.push_back(value_type(3)); // list should be [2 1 3]
+ VERIFY(list0101.size() == 3);
+ VERIFY(copy_constructor::count() == 3);
+ VERIFY(k->id() == 1);
+
+ try
+ {
+ list0101.push_back(value_type(4, true));
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ VERIFY(list0101.size() == 3);
+ VERIFY(copy_constructor::count() == 4);
+ }
+
+ i = list0101.begin();
+ VERIFY(i->id() == 2);
+ VERIFY(i->id() == list0101.front().id());
+
+ j = list0101.rbegin();
+ VERIFY(j->id() == 3);
+ VERIFY(j->id() == list0101.back().id());
+
+ ++i;
+ VERIFY(i->id() == 1);
+
+ ++j;
+ VERIFY(j->id() == 1);
+
+ value_type::reset();
+
+ list0101.pop_back(); // list should be [2 1]
+ VERIFY(list0101.size() == 2);
+ VERIFY(destructor::count() == 1);
+ VERIFY(i->id() == 1);
+ VERIFY(k->id() == 1);
+
+ list0101.pop_front(); // list should be [1]
+ VERIFY(list0101.size() == 1);
+ VERIFY(destructor::count() == 2);
+ VERIFY(i->id() == 1);
+ VERIFY(k->id() == 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
new file mode 100644
index 000000000..6fbcf6c17
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
@@ -0,0 +1,31 @@
+// { dg-require-time "" }
+
+// Copyright (C) 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 "25288.h"
+#include <list>
+
+int main()
+{
+ typedef int value_type;
+ typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+
+ insert1<list_type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.h
new file mode 100644
index 000000000..772128d95
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.h
@@ -0,0 +1,90 @@
+// Copyright (C) 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/>.
+
+// 23.2.2.3 list modifiers [lib.list.modifiers]
+
+#include <testsuite_hooks.h>
+#include <ext/throw_allocator.h>
+
+// libstdc++/25288
+template<typename _Tp>
+void insert1()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp list_type;
+ typedef typename _Tp::value_type value_type;
+ typedef typename _Tp::allocator_type allocator_type;
+ typedef typename _Tp::size_type size_type;
+
+ for (int j = 0; j < 10; ++j)
+ for (int i = 0; i < 10; ++i)
+ {
+ allocator_type alloc1;
+ typename allocator_type::never_adjustor adjust1;
+ list_type list1(alloc1);
+
+ for (int k = 0; k < j; ++k)
+ list1.push_back(value_type(-(k + 1)));
+
+ try
+ {
+ typename allocator_type::always_adjustor adjust2;
+ list1.insert(list1.begin(), 10, 99);
+ VERIFY( false );
+ }
+ catch (__gnu_cxx::forced_error&)
+ {
+ VERIFY( true );
+ }
+ catch (...)
+ {
+ __throw_exception_again;
+ }
+
+ VERIFY( list1.size() == size_type(j) );
+ VERIFY( list1.size() == 0 || list1.back() == -j );
+ VERIFY( list1.size() == 0 || list1.front() == -1 );
+
+ allocator_type alloc2;
+ list_type list2(alloc2);
+
+ const int data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+
+ for (int k = 0; k < j; ++k)
+ list2.push_back(-(k + 1));
+
+ try
+ {
+ typename allocator_type::always_adjustor adjust3;
+ list2.insert(list2.begin(), data, data + 10);
+ VERIFY( false );
+ }
+ catch (__gnu_cxx::forced_error&)
+ {
+ VERIFY( true );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ VERIFY( list2.size() == size_type(j) );
+ VERIFY( list2.size() == 0 || list2.back() == -j );
+ VERIFY( list2.size() == 0 || list2.front() == -1 );
+ }
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
new file mode 100644
index 000000000..767640ea9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
@@ -0,0 +1,35 @@
+// 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 <list>
+#include "1.h"
+
+namespace std
+{
+ template<>
+ void
+ list<T, allocator<T> >::swap(list<T, allocator<T> >&)
+ { ++swap_calls; }
+}
+
+// See c++/13658 for background info.
+int main()
+{
+ swap11<std::list<T> >();
+ swap12<std::list<T> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.h
new file mode 100644
index 000000000..64619b424
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.h
@@ -0,0 +1,58 @@
+// 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 <algorithm>
+#include <testsuite_hooks.h>
+
+struct T { int i; };
+
+int swap_calls;
+
+// Should use list specialization for swap.
+template<typename _Tp>
+void
+swap11()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ list_type A;
+ list_type B;
+ swap_calls = 0;
+ std::swap(A, B);
+ VERIFY(1 == swap_calls);
+}
+
+// Should use list specialization for swap.
+template<typename _Tp>
+void
+swap12()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ list_type A;
+ list_type B;
+ swap_calls = 0;
+ swap(A, B);
+ VERIFY(1 == swap_calls);
+}
+
+#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
+template class __gnu_cxx::__mt_alloc<std::_List_node<T> >;
+#endif
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
new file mode 100644
index 000000000..d1faf025f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
@@ -0,0 +1,31 @@
+// 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/>.
+
+#include <list>
+#include "2.h"
+
+int main()
+{
+ typedef char value_type;
+ typedef __gnu_test::uneq_allocator<value_type> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+
+ swap2<list_type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.h
new file mode 100644
index 000000000..2cd68f60c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.h
@@ -0,0 +1,127 @@
+// 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.2.2.3 list::swap
+
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator as a non-empty allocator.
+template<typename _Tp>
+void
+swap2()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::size_type size_type;
+
+ 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);
+
+ size_type size01, size02;
+
+ allocator_type alloc01(1);
+
+ list_type lis01(alloc01);
+ size01 = lis01.size();
+ list_type lis02(alloc01);
+ size02 = lis02.size();
+
+ lis01.swap(lis02);
+ VERIFY( lis01.size() == size02 );
+ VERIFY( lis01.empty() );
+ VERIFY( lis02.size() == size01 );
+ VERIFY( lis02.empty() );
+
+ list_type lis03(alloc01);
+ size01 = lis03.size();
+ list_type lis04(title02, title02 + N2, alloc01);
+ size02 = lis04.size();
+
+ lis03.swap(lis04);
+ VERIFY( lis03.size() == size02 );
+ VERIFY( equal(lis03.begin(), lis03.end(), title02) );
+ VERIFY( lis04.size() == size01 );
+ VERIFY( lis04.empty() );
+
+ list_type lis05(title01, title01 + N1, alloc01);
+ size01 = lis05.size();
+ list_type lis06(title02, title02 + N2, alloc01);
+ size02 = lis06.size();
+
+ lis05.swap(lis06);
+ VERIFY( lis05.size() == size02 );
+ VERIFY( equal(lis05.begin(), lis05.end(), title02) );
+ VERIFY( lis06.size() == size01 );
+ VERIFY( equal(lis06.begin(), lis06.end(), title01) );
+
+ list_type lis07(title01, title01 + N1, alloc01);
+ size01 = lis07.size();
+ list_type lis08(title03, title03 + N3, alloc01);
+ size02 = lis08.size();
+
+ lis07.swap(lis08);
+ VERIFY( lis07.size() == size02 );
+ VERIFY( equal(lis07.begin(), lis07.end(), title03) );
+ VERIFY( lis08.size() == size01 );
+ VERIFY( equal(lis08.begin(), lis08.end(), title01) );
+
+ list_type lis09(title03, title03 + N3, alloc01);
+ size01 = lis09.size();
+ list_type lis10(title04, title04 + N4, alloc01);
+ size02 = lis10.size();
+
+ lis09.swap(lis10);
+ VERIFY( lis09.size() == size02 );
+ VERIFY( equal(lis09.begin(), lis09.end(), title04) );
+ VERIFY( lis10.size() == size01 );
+ VERIFY( equal(lis10.begin(), lis10.end(), title03) );
+
+ list_type lis11(title04, title04 + N4, alloc01);
+ size01 = lis11.size();
+ list_type lis12(title01, title01 + N1, alloc01);
+ size02 = lis12.size();
+
+ lis11.swap(lis12);
+ VERIFY( lis11.size() == size02 );
+ VERIFY( equal(lis11.begin(), lis11.end(), title01) );
+ VERIFY( lis12.size() == size01 );
+ VERIFY( equal(lis12.begin(), lis12.end(), title04) );
+
+ list_type lis13(title03, title03 + N3, alloc01);
+ size01 = lis13.size();
+ list_type lis14(title03, title03 + N3, alloc01);
+ size02 = lis14.size();
+
+ lis13.swap(lis14);
+ VERIFY( lis13.size() == size02 );
+ VERIFY( equal(lis13.begin(), lis13.end(), title03) );
+ VERIFY( lis14.size() == size01 );
+ VERIFY( equal(lis14.begin(), lis14.end(), title03) );
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
new file mode 100644
index 000000000..676466d53
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
@@ -0,0 +1,31 @@
+// 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/>.
+
+#include <list>
+#include "3.h"
+
+int main()
+{
+ typedef char value_type;
+ typedef __gnu_test::uneq_allocator<value_type> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+
+ swap3<list_type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.h
new file mode 100644
index 000000000..b4f2cd097
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.h
@@ -0,0 +1,156 @@
+// 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.2.2.3 list::swap
+
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator, two different personalities.
+template<typename _Tp>
+void
+swap3()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::size_type size_type;
+
+ 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);
+
+ size_type size01, size02;
+
+ allocator_type alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ list_type lis01(alloc01);
+ size01 = lis01.size();
+ personality01 = lis01.get_allocator().get_personality();
+ list_type lis02(alloc02);
+ size02 = lis02.size();
+ personality02 = lis02.get_allocator().get_personality();
+
+ lis01.swap(lis02);
+ VERIFY( lis01.size() == size02 );
+ VERIFY( lis01.empty() );
+ VERIFY( lis02.size() == size01 );
+ VERIFY( lis02.empty() );
+ VERIFY( lis01.get_allocator().get_personality() == personality02 );
+ VERIFY( lis02.get_allocator().get_personality() == personality01 );
+
+ list_type lis03(alloc02);
+ size01 = lis03.size();
+ personality01 = lis03.get_allocator().get_personality();
+ list_type lis04(title02, title02 + N2, alloc01);
+ size02 = lis04.size();
+ personality02 = lis04.get_allocator().get_personality();
+
+ lis03.swap(lis04);
+ VERIFY( lis03.size() == size02 );
+ VERIFY( equal(lis03.begin(), lis03.end(), title02) );
+ VERIFY( lis04.size() == size01 );
+ VERIFY( lis04.empty() );
+ VERIFY( lis03.get_allocator().get_personality() == personality02 );
+ VERIFY( lis04.get_allocator().get_personality() == personality01 );
+
+ list_type lis05(title01, title01 + N1, alloc01);
+ size01 = lis05.size();
+ personality01 = lis05.get_allocator().get_personality();
+ list_type lis06(title02, title02 + N2, alloc02);
+ size02 = lis06.size();
+ personality02 = lis06.get_allocator().get_personality();
+
+ lis05.swap(lis06);
+ VERIFY( lis05.size() == size02 );
+ VERIFY( equal(lis05.begin(), lis05.end(), title02) );
+ VERIFY( lis06.size() == size01 );
+ VERIFY( equal(lis06.begin(), lis06.end(), title01) );
+ VERIFY( lis05.get_allocator().get_personality() == personality02 );
+ VERIFY( lis06.get_allocator().get_personality() == personality01 );
+
+ list_type lis07(title01, title01 + N1, alloc02);
+ size01 = lis07.size();
+ personality01 = lis07.get_allocator().get_personality();
+ list_type lis08(title03, title03 + N3, alloc01);
+ size02 = lis08.size();
+ personality02 = lis08.get_allocator().get_personality();
+
+ lis07.swap(lis08);
+ VERIFY( lis07.size() == size02 );
+ VERIFY( equal(lis07.begin(), lis07.end(), title03) );
+ VERIFY( lis08.size() == size01 );
+ VERIFY( equal(lis08.begin(), lis08.end(), title01) );
+ VERIFY( lis07.get_allocator().get_personality() == personality02 );
+ VERIFY( lis08.get_allocator().get_personality() == personality01 );
+
+ list_type lis09(title03, title03 + N3, alloc01);
+ size01 = lis09.size();
+ personality01 = lis09.get_allocator().get_personality();
+ list_type lis10(title04, title04 + N4, alloc02);
+ size02 = lis10.size();
+ personality02 = lis10.get_allocator().get_personality();
+
+ lis09.swap(lis10);
+ VERIFY( lis09.size() == size02 );
+ VERIFY( equal(lis09.begin(), lis09.end(), title04) );
+ VERIFY( lis10.size() == size01 );
+ VERIFY( equal(lis10.begin(), lis10.end(), title03) );
+ VERIFY( lis09.get_allocator().get_personality() == personality02 );
+ VERIFY( lis10.get_allocator().get_personality() == personality01 );
+
+ list_type lis11(title04, title04 + N4, alloc02);
+ size01 = lis11.size();
+ personality01 = lis11.get_allocator().get_personality();
+ list_type lis12(title01, title01 + N1, alloc01);
+ size02 = lis12.size();
+ personality02 = lis12.get_allocator().get_personality();
+
+ lis11.swap(lis12);
+ VERIFY( lis11.size() == size02 );
+ VERIFY( equal(lis11.begin(), lis11.end(), title01) );
+ VERIFY( lis12.size() == size01 );
+ VERIFY( equal(lis12.begin(), lis12.end(), title04) );
+ VERIFY( lis11.get_allocator().get_personality() == personality02 );
+ VERIFY( lis12.get_allocator().get_personality() == personality01 );
+
+ list_type lis13(title03, title03 + N3, alloc01);
+ size01 = lis13.size();
+ personality01 = lis13.get_allocator().get_personality();
+ list_type lis14(title03, title03 + N3, alloc02);
+ size02 = lis14.size();
+ personality02 = lis14.get_allocator().get_personality();
+
+ lis13.swap(lis14);
+ VERIFY( lis13.size() == size02 );
+ VERIFY( equal(lis13.begin(), lis13.end(), title03) );
+ VERIFY( lis14.size() == size01 );
+ VERIFY( equal(lis14.begin(), lis14.end(), title03) );
+ VERIFY( lis13.get_allocator().get_personality() == personality02 );
+ VERIFY( lis14.get_allocator().get_personality() == personality01 );
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/1.cc b/libstdc++-v3/testsuite/23_containers/list/operations/1.cc
new file mode 100644
index 000000000..48c7d908c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/1.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "1.h"
+#include <list>
+
+int main()
+{
+ operations01<std::list<int> >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/1.h b/libstdc++-v3/testsuite/23_containers/list/operations/1.h
new file mode 100644
index 000000000..601c5e772
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/1.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+// splice(p, x) + remove + reverse
+template<typename _Tp>
+void
+operations01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int K = 417;
+ const int A[] = {1, 2, 3, 4, 5};
+ const int B[] = {K, K, K, K, K};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ const std::size_t M = sizeof(B) / sizeof(int);
+
+ list_type list0101(A, A + N);
+ list_type list0102(B, B + M);
+ iterator p = list0101.begin();
+
+ VERIFY(list0101.size() == N);
+ VERIFY(list0102.size() == M);
+
+ ++p;
+ list0101.splice(p, list0102); // [1 K K K K K 2 3 4 5]
+ VERIFY(list0101.size() == N + M);
+ VERIFY(list0102.size() == 0);
+
+ // remove range from middle
+ list0101.remove(K);
+ VERIFY(list0101.size() == N);
+
+ // remove first element
+ list0101.remove(1);
+ VERIFY(list0101.size() == N - 1);
+
+ // remove last element
+ list0101.remove(5);
+ VERIFY(list0101.size() == N - 2);
+
+ // reverse
+ list0101.reverse();
+ p = list0101.begin();
+ VERIFY(*p == 4); ++p;
+ VERIFY(*p == 3); ++p;
+ VERIFY(*p == 2); ++p;
+ VERIFY(p == list0101.end());
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/2.cc b/libstdc++-v3/testsuite/23_containers/list/operations/2.cc
new file mode 100644
index 000000000..7cd576220
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/2.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2001, 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/>.
+
+#include "2.h"
+#include <list>
+
+int main()
+{
+ operations02<std::list<int> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/2.h b/libstdc++-v3/testsuite/23_containers/list/operations/2.h
new file mode 100644
index 000000000..6db3333bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/2.h
@@ -0,0 +1,54 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+// splice(p, x, i) + remove_if + operator==
+template<typename _Tp>
+void
+operations02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int A[] = {1, 2, 3, 4, 5};
+ const int B[] = {2, 1, 3, 4, 5};
+ const int C[] = {1, 3, 4, 5, 2};
+ const int N = sizeof(A) / sizeof(int);
+ list_type list0201(A, A + N);
+ list_type list0202(A, A + N);
+ list_type list0203(B, B + N);
+ list_type list0204(C, C + N);
+ iterator i = list0201.begin();
+
+ // result should be unchanged
+ list0201.splice(list0201.begin(), list0201, i);
+ VERIFY(list0201 == list0202);
+
+ // result should be [2 1 3 4 5]
+ ++i;
+ list0201.splice(list0201.begin(), list0201, i);
+ VERIFY(list0201 != list0202);
+ VERIFY(list0201 == list0203);
+
+ // result should be [1 3 4 5 2]
+ list0201.splice(list0201.end(), list0201, i);
+ VERIFY(list0201 == list0204);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/2_c++0x.cc b/libstdc++-v3/testsuite/23_containers/list/operations/2_c++0x.cc
new file mode 100644
index 000000000..6d744a015
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/2_c++0x.cc
@@ -0,0 +1,27 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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 "2.h"
+#include <list>
+
+int main()
+{
+ operations02<std::list<int> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/3.cc b/libstdc++-v3/testsuite/23_containers/list/operations/3.cc
new file mode 100644
index 000000000..1ed46b21d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/3.cc
@@ -0,0 +1,25 @@
+// Copyright (C) 2001, 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/>.
+
+#include "3.h"
+#include <list>
+
+int main(void)
+{
+ operations03<std::list<int> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/3.h b/libstdc++-v3/testsuite/23_containers/list/operations/3.h
new file mode 100644
index 000000000..9181e7ea9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/3.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+// splice(p, x, f, l) + sort + merge + unique
+template<typename _Tp>
+void
+operations03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int A[] = {103, 203, 603, 303, 403, 503};
+ const int B[] = {417, 417, 417, 417, 417};
+ const int E[] = {103, 417, 417, 203, 603, 303, 403, 503};
+ const int F[] = {103, 203, 303, 403, 417, 417, 503, 603};
+ const int C[] = {103, 203, 303, 403, 417, 417, 417, 417, 417, 503, 603};
+ const int D[] = {103, 203, 303, 403, 417, 503, 603};
+ const int N = sizeof(A) / sizeof(int);
+ const int M = sizeof(B) / sizeof(int);
+ const int P = sizeof(C) / sizeof(int);
+ const int Q = sizeof(D) / sizeof(int);
+ const int R = sizeof(E) / sizeof(int);
+
+ list_type list0301(A, A + N);
+ list_type list0302(B, B + M);
+ list_type list0303(C, C + P);
+ list_type list0304(D, D + Q);
+ list_type list0305(E, E + R);
+ list_type list0306(F, F + R);
+ iterator p = list0301.begin();
+ iterator q = list0302.begin();
+
+ ++p; ++q; ++q;
+ list0301.splice(p, list0302, list0302.begin(), q);
+ VERIFY(list0301 == list0305);
+ VERIFY(list0301.size() == N + 2);
+ VERIFY(list0302.size() == M - 2);
+
+ list0301.sort();
+ VERIFY(list0301 == list0306);
+
+ list0301.merge(list0302);
+ VERIFY(list0301.size() == N + M);
+ VERIFY(list0302.size() == 0);
+ VERIFY(list0301 == list0303);
+
+ list0301.unique();
+ VERIFY(list0301 == list0304);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/35969.cc b/libstdc++-v3/testsuite/23_containers/list/operations/35969.cc
new file mode 100644
index 000000000..2442f9601
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/35969.cc
@@ -0,0 +1,79 @@
+// Copyright (C) 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.2.2.4 list operations [lib.list.ops]
+
+// NB: This issue affected only debug-mode.
+
+#include <list>
+#include <functional>
+
+// libstdc++/35969
+void test01()
+{
+ {
+ std::list<int> list1;
+ std::list<int> list2;
+
+ for(int i = 0; i < 10; ++i)
+ {
+ list1.push_back(i);
+ list2.push_back(10 - i);
+ }
+
+ list1.sort();
+ list2.sort();
+
+ std::list<int>::iterator node_of_interest = list2.begin();
+
+ list1.splice(list1.begin(), list2, node_of_interest);
+ list2.splice(list2.begin(), list1, node_of_interest);
+
+ list1.merge(list2);
+
+ list2.splice(list2.begin(), list1, node_of_interest);
+ }
+
+ {
+ std::list<int> list1;
+ std::list<int> list2;
+
+ for(int i = 0; i < 10; ++i)
+ {
+ list1.push_back(i);
+ list2.push_back(10 - i);
+ }
+
+ list1.sort();
+ list2.sort();
+
+ std::list<int>::iterator node_of_interest = list2.begin();
+
+ list1.splice(list1.begin(), list2, node_of_interest);
+ list2.splice(list2.begin(), list1, node_of_interest);
+
+ list1.merge(list2, std::less<int>());
+
+ list2.splice(list2.begin(), list1, node_of_interest);
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/3_c++0x.cc b/libstdc++-v3/testsuite/23_containers/list/operations/3_c++0x.cc
new file mode 100644
index 000000000..37a480606
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/3_c++0x.cc
@@ -0,0 +1,27 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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 "3.h"
+#include <list>
+
+int main()
+{
+ operations03<std::list<int> >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/4.cc b/libstdc++-v3/testsuite/23_containers/list/operations/4.cc
new file mode 100644
index 000000000..4e14f1ae6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/4.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2001, 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/>.
+
+#include "4.h"
+#include <list>
+
+int main()
+{
+ operations04<std::list<int> >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/4.h b/libstdc++-v3/testsuite/23_containers/list/operations/4.h
new file mode 100644
index 000000000..650282747
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/4.h
@@ -0,0 +1,92 @@
+// Copyright (C) 2001, 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/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+// A comparison predicate to order by rightmost digit. Tracks call
+// counts for performance checks.
+struct CompLastLt
+{
+ bool operator()(const int x, const int y)
+ { ++itsCount; return x % 10 < y % 10; }
+ static int count() { return itsCount; }
+ static void reset() { itsCount = 0; }
+ static int itsCount;
+};
+
+int CompLastLt::itsCount;
+
+struct CompLastEq
+{
+ bool operator()(const int x, const int y)
+ { ++itsCount; return x % 10 == y % 10; }
+ static int count() { return itsCount; }
+ static void reset() { itsCount = 0; }
+ static int itsCount;
+};
+
+int CompLastEq::itsCount;
+
+// sort(pred) + merge(pred) + unique(pred)
+// also checks performance requirements
+template<typename _Tp>
+void
+operations04()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ const int A[] = {1, 2, 3, 4, 5, 6};
+ const int B[] = {12, 15, 13, 14, 11};
+ const int C[] = {11, 12, 13, 14, 15};
+ const int D[] = {1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6};
+ const int N = sizeof(A) / sizeof(int);
+ const int M = sizeof(B) / sizeof(int);
+ const int Q = sizeof(D) / sizeof(int);
+
+ list_type list0401(A, A + N);
+ list_type list0402(B, B + M);
+ list_type list0403(C, C + M);
+ list_type list0404(D, D + Q);
+ list_type list0405(A, A + N);
+
+ // sort B
+ CompLastLt lt;
+
+ CompLastLt::reset();
+ list0402.sort(lt);
+ VERIFY(list0402 == list0403);
+
+ CompLastLt::reset();
+ list0401.merge(list0402, lt);
+ VERIFY(list0401 == list0404);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(lt.count() <= (N + M - 1));
+#endif
+
+ CompLastEq eq;
+
+ CompLastEq::reset();
+ list0401.unique(eq);
+ VERIFY(list0401 == list0405);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(eq.count() == (N + M - 1));
+#endif
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/42352.cc b/libstdc++-v3/testsuite/23_containers/list/operations/42352.cc
new file mode 100644
index 000000000..7e6c9c4f1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/42352.cc
@@ -0,0 +1,66 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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 <list>
+#include <testsuite_hooks.h>
+
+// PR libstdc++/42352
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::list<int> l{3, 2, 4, 1, 5, 9, 0, 8, 6, 7};
+
+ l.sort();
+
+ for (auto it = l.begin(); it != l.end(); ++it)
+ {
+ static int nn = 0;
+ VERIFY( *it == nn++ );
+ }
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::list<int> l{3, 2, 4, 1, 5, 9, 0, 8, 6, 7};
+
+ struct compare
+ {
+ bool
+ operator()(int const& one, int const& two) const
+ { return one > two; }
+ };
+
+ l.sort(compare());
+
+ for (auto it = l.begin(); it != l.end(); ++it)
+ {
+ static int nn = 9;
+ VERIFY( *it == nn-- );
+ }
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/5.cc b/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
new file mode 100644
index 000000000..bcfbb81b7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
@@ -0,0 +1,31 @@
+// 2006-01-19 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 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 "5.h"
+#include <list>
+
+int main()
+{
+ typedef int value_type;
+ typedef __gnu_test::uneq_allocator<value_type> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+
+ operations05<list_type>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/5.h b/libstdc++-v3/testsuite/23_containers/list/operations/5.h
new file mode 100644
index 000000000..0820e8a69
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/5.h
@@ -0,0 +1,134 @@
+// 2006-01-19 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 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/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <stdexcept>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// Check the splice (and merge) bits of N1599.
+template<typename _Tp>
+void
+operations05()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
+
+ const int data1[] = {1, 2, 3, 4, 5};
+ const int data2[] = {6, 7, 8, 9, 10};
+ const size_t N1 = sizeof(data1) / sizeof(int);
+ const size_t N2 = sizeof(data2) / sizeof(int);
+
+ allocator_type alloc01(1), alloc02(2);
+
+ list_type l01(data1, data1 + N1, alloc01);
+ const list_type l01_ref = l01;
+
+ list_type l02(data2, data2 + N2, alloc02);
+ const list_type l02_ref = l02;
+
+ bool catched = false;
+
+ try
+ {
+ l01.splice(l01.begin(), l02);
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+
+ catched = false;
+ try
+ {
+ l01.splice(l01.begin(), l02, l02.begin());
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+
+ catched = false;
+ try
+ {
+ l01.splice(l01.begin(), l02, l02.begin(), l02.end());
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+
+ catched = false;
+ try
+ {
+ l01.merge(l02);
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+
+ catched = false;
+ try
+ {
+ l01.merge(l02, std::less<int>());
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc
new file mode 100644
index 000000000..00dc817b1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc
@@ -0,0 +1,131 @@
+// 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
+//
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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 run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options "-pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options "-pthreads" { target *-*-solaris* } }
+
+// This multi-threading C++/STL/POSIX code adheres to rules outlined here:
+// http://www.sgi.com/tech/stl/thread_safety.html
+//
+// It is believed to exercise the allocation code in a manner that
+// should reveal memory leaks (and, under rare cases, race conditions,
+// if the STL threading support is fubar'd).
+
+#include <list>
+#include <cstdlib>
+#include <pthread.h>
+
+const int thread_cycles = 10;
+const int thread_pairs = 10;
+const unsigned max_size = 100;
+const int iters = 10000;
+
+class task_queue
+{
+ typedef std::list<int> list_type;
+
+public:
+ task_queue ()
+ {
+ pthread_mutex_init (&fooLock, 0);
+ pthread_cond_init (&fooCond1, 0);
+ pthread_cond_init (&fooCond2, 0);
+ }
+ ~task_queue ()
+ {
+ pthread_mutex_destroy (&fooLock);
+ pthread_cond_destroy (&fooCond1);
+ pthread_cond_destroy (&fooCond2);
+ }
+
+ list_type foo;
+ pthread_mutex_t fooLock;
+ pthread_cond_t fooCond1;
+ pthread_cond_t fooCond2;
+};
+
+void*
+produce(void* t)
+{
+ task_queue& tq = *(static_cast<task_queue*> (t));
+ int num = 0;
+ while (num < iters)
+ {
+ pthread_mutex_lock (&tq.fooLock);
+ while (tq.foo.size () >= max_size)
+ pthread_cond_wait (&tq.fooCond1, &tq.fooLock);
+ tq.foo.push_back (num++);
+ pthread_cond_signal (&tq.fooCond2);
+ pthread_mutex_unlock (&tq.fooLock);
+ }
+ return 0;
+}
+
+void*
+consume(void* t)
+{
+ task_queue& tq = *(static_cast<task_queue*> (t));
+ int num = 0;
+ while (num < iters)
+ {
+ pthread_mutex_lock (&tq.fooLock);
+ while (tq.foo.size () == 0)
+ pthread_cond_wait (&tq.fooCond2, &tq.fooLock);
+ if (tq.foo.front () != num++)
+ abort ();
+ tq.foo.pop_front ();
+ pthread_cond_signal (&tq.fooCond1);
+ pthread_mutex_unlock (&tq.fooLock);
+ }
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t prod[thread_pairs];
+ pthread_t cons[thread_pairs];
+
+ task_queue* tq[thread_pairs];
+
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
+ pthread_setconcurrency (thread_pairs * 2);
+#endif
+
+ for (int j = 0; j < thread_cycles; j++)
+ {
+ for (int i = 0; i < thread_pairs; i++)
+ {
+ tq[i] = new task_queue;
+ pthread_create (&prod[i], 0, produce, static_cast<void*> (tq[i]));
+ pthread_create (&cons[i], 0, consume, static_cast<void*> (tq[i]));
+ }
+
+ for (int i = 0; i < thread_pairs; i++)
+ {
+ pthread_join (prod[i], 0);
+ pthread_join (cons[i], 0);
+ delete tq[i];
+ }
+ }
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc
new file mode 100644
index 000000000..4f4643721
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc
@@ -0,0 +1,125 @@
+// 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
+// Adpated from libstdc++/5464 submitted by jjessel@amadeus.net
+// Jean-Francois JESSEL (Amadeus SAS Development)
+//
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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 run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options "-pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options "-pthreads" { target *-*-solaris* } }
+
+#include <vector>
+#include <list>
+#include <string>
+#include <cstdlib>
+#include <pthread.h>
+
+#ifdef _GLIBCXX_HAVE_UNISTD_H
+#include <unistd.h> // To test for _POSIX_THREAD_PRIORITY_SCHEDULING
+#endif
+
+#define NTHREADS 8
+#define LOOPS 20
+
+struct tt_t
+{
+ char buf[100];
+ int i;
+};
+
+void*
+thread_function (void* arg)
+{
+ typedef std::vector<tt_t> vector_type;
+ typedef std::list<std::string*> list_type;
+
+ int myid __attribute__((unused)) = *(int*) arg;
+ for (int i = 0; i < LOOPS; i++)
+ {
+ vector_type myvect1;
+
+ for (int j = 0; j < 2000; j++)
+ {
+ vector_type myvect2;
+ tt_t v;
+ v.i = j;
+ myvect1.push_back (v);
+ myvect2.push_back (v);
+ list_type mylist;
+ std::string string_array[4];
+ string_array[0] = "toto";
+ string_array[1] = "titi";
+ string_array[2] = "tata";
+ string_array[3] = "tutu";
+ for (int k = 0; k < 4; k++)
+ {
+ if (mylist.size ())
+ {
+ list_type::iterator aIt;
+ for (aIt = mylist.begin (); aIt != mylist.end (); ++aIt)
+ {
+ if ((*aIt) == &(string_array[k]))
+ abort ();
+ }
+ }
+ mylist.push_back (&(string_array[k]));
+ }
+ }
+ }
+
+ return arg;
+}
+
+int
+main ()
+{
+ int worker;
+ pthread_t threads[NTHREADS];
+ int ids[NTHREADS];
+ void* status;
+
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
+ pthread_setconcurrency (NTHREADS);
+#endif
+
+ pthread_attr_t tattr;
+ int ret __attribute__((unused)) = pthread_attr_init (&tattr);
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+ ret = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM);
+#endif
+
+ for (worker = 0; worker < NTHREADS; worker++)
+ {
+ ids[worker] = worker;
+ if (pthread_create(&threads[worker], &tattr,
+ thread_function, &ids[worker]))
+ abort ();
+ }
+
+ for (worker = 0; worker < NTHREADS; worker++)
+ {
+ if (pthread_join(threads[worker], static_cast<void **>(&status)))
+ abort ();
+
+ if (*((int *)status) != worker)
+ abort ();
+ }
+
+ return (0);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/range_access.cc b/libstdc++-v3/testsuite/23_containers/list/range_access.cc
new file mode 100644
index 000000000..768bd638a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+
+void
+test01()
+{
+ std::list<int> l{1, 2, 3};
+ std::begin(l);
+ std::end(l);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc
new file mode 100644
index 000000000..ac5bdec98
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+#include <testsuite_containers.h>
+
+int main()
+{
+ typedef std::list<int> test_type;
+ __gnu_test::citerator<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
new file mode 100644
index 000000000..96a14e4da
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -0,0 +1,36 @@
+// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 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/>.
+
+// { dg-do compile }
+// { dg-error "no matching" "" { target *-*-* } 1491 }
+// { dg-excess-errors "" }
+
+#include <list>
+
+struct A
+{
+ explicit A(int) { }
+};
+
+void f()
+{
+ typedef std::list<A> list_type;
+ list_type l;
+ l.assign(10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc
new file mode 100644
index 000000000..5c0bf6f72
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc
@@ -0,0 +1,28 @@
+// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 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/>.
+
+// { dg-do compile }
+
+#include <list>
+
+void f()
+{
+ typedef std::list<int> list_type;
+ list_type l(10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
new file mode 100644
index 000000000..cc10877fa
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -0,0 +1,30 @@
+// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 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/>.
+
+// { dg-do compile }
+// { dg-error "no matching" "" { target *-*-* } 1447 }
+// { dg-excess-errors "" }
+
+#include <list>
+
+void f()
+{
+ typedef std::list<std::list<int> > list_type;
+ list_type l(10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
new file mode 100644
index 000000000..acc64e4af
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -0,0 +1,31 @@
+// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 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/>.
+
+// { dg-do compile }
+// { dg-error "no matching" "" { target *-*-* } 1447 }
+// { dg-excess-errors "" }
+
+#include <list>
+#include <utility>
+
+void f()
+{
+ typedef std::list<std::list<std::pair<char, char> > > list_type;
+ list_type l('a', 'b');
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
new file mode 100644
index 000000000..8df0ac528
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -0,0 +1,36 @@
+// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 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/>.
+
+// { dg-do compile }
+// { dg-error "no matching" "" { target *-*-* } 1447 }
+// { dg-excess-errors "" }
+
+#include <list>
+
+struct A
+{
+ explicit A(int) { }
+};
+
+void f()
+{
+ typedef std::list<A> list_type;
+ list_type l;
+ l.insert(l.begin(), 10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/exception/basic.cc
new file mode 100644
index 000000000..33232f965
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/exception/basic.cc
@@ -0,0 +1,40 @@
+// { 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 <list>
+#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::list<value_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/list/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/exception/generation_prohibited.cc
new file mode 100644
index 000000000..f3d16028e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/exception/generation_prohibited.cc
@@ -0,0 +1,34 @@
+// { 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 <list>
+#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::list<value_type, allocator_type> test_type;
+ __gnu_test::generation_prohibited<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/exception/propagation_consistent.cc
new file mode 100644
index 000000000..02d8d0b25
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/exception/propagation_consistent.cc
@@ -0,0 +1,34 @@
+// { 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 <list>
+#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::list<value_type, allocator_type> test_type;
+ __gnu_test::propagation_consistent<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000..787fe3801
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+
+// { dg-do compile }
+
+template class std::list<int>;
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/1_c++0x.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/1_c++0x.cc
new file mode 100644
index 000000000..78e026a7f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+
+template class std::list<int>;
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/2.cc
new file mode 100644
index 000000000..50ae78560
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/2.cc
@@ -0,0 +1,30 @@
+// 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 <list>
+#include <testsuite_api.h>
+
+// { dg-do compile }
+
+// N.B. In C++0x mode we cannot instantiate with T == NonDefaultConstructible
+// because of 23.3.4.1.4
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+template class std::list<__gnu_test::NonDefaultConstructible>;
+#endif
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/3.cc
new file mode 100644
index 000000000..ddc34e4be
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+
+// { dg-do compile }
+
+// libstdc++/21770
+template class std::list<int, std::allocator<char> >;
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/4.cc
new file mode 100644
index 000000000..7ad82a365
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+// { dg-do compile }
+
+// libstdc++/41792
+template class std::list<__gnu_test::OverloadedAddress>;
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc
new file mode 100644
index 000000000..69d25cf70
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 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 user specialization of library containers
+
+#include <list>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+struct user_type {};
+
+namespace std
+{
+ template<typename Allocator>
+ class list<user_type, Allocator> { };
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/typedefs.cc
new file mode 100644
index 000000000..444ebb540
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/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 <list>
+
+// Check container for required typedefs.
+__gnu_test::types<std::list<int> > t;