summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/vector
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/23_containers/vector
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/vector')
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/14340.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/15523.cc39
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/18604.cc42
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/26412-1.cc28
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/26412-2.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/40192.cc28
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/1.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/21244.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/23632.cc39
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/6886.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/capacity/1.cc137
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/capacity/29134.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/clear_allocator.cc87
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/cons/1.cc178
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/cons/2.cc180
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/hash/1.cc45
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/erase/1.cc136
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/1.cc171
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc199
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/swap/1.cc145
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/swap/2.cc174
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/requirements/dr438/constructor.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/1.cc61
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/2.cc102
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/29134-2.cc50
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/29134.cc37
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/44190.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/8230.cc78
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/reserve/moveable.cc47
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc60
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc56
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc42
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/check_construct_destroy.cc76
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/1.cc47
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/2.cc48
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/3.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/4.cc584
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/6513.cc39
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/clear_allocator.cc87
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc62
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/moveable2.cc55
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/data_access/1.cc50
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/52433.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/assign1_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/assign2_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/assign3_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/construct1_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/construct2_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/construct3_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/construct4_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/insert1_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/insert2_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/insert3_neg.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/insert4_neg.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/1.cc59
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/2.cc64
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/3.cc89
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/4.cc66
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/multithreaded_swap.cc100
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug_mode_requires_reallocation-1.cc50
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug_mode_requires_reallocation-2.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/element_access/1.cc61
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/citerators.cc46
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/data_access.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/1.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/3.cc28
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/element.cc77
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/erase.cc139
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/insert.cc67
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/resize.cc65
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/1.cc61
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/init-list.cc60
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/1.cc55
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/2.cc61
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/1.cc135
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/50529.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/moveable.cc62
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/1.cc49
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/moveable.cc137
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/1.cc62
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/2.cc132
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/3.cc161
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc18
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/range_access.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/exception/basic.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/exception/generation_prohibited.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/exception/propagation_consistent.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/1.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/1_c++0x.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/2.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/3.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/4.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/partial_specialization/1.cc33
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/typedefs.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/types/1.cc41
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/types/23767.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc68
107 files changed, 6861 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/vector/14340.cc b/libstdc++-v3/testsuite/23_containers/vector/14340.cc
new file mode 100644
index 000000000..0d4e45df9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+
+// NB: This issue affected only debug-mode.
+
+// { dg-do compile }
+
+// libstdc++/14340
+int main()
+{
+ typedef std::vector<int> container;
+ __gnu_test::conversion<container>::iterator_to_const_iterator();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/15523.cc b/libstdc++-v3/testsuite/23_containers/vector/15523.cc
new file mode 100644
index 000000000..c5f489483
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/15523.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This issue affected only debug-mode.
+
+#include <vector>
+
+// libstdc++/15523
+void test01()
+{
+ using namespace std;
+
+ vector<vector<int>::const_iterator> x(2);
+
+ vector<int>::iterator i2, i3;
+ vector<int>::const_iterator ci1(i2);
+
+ i2 = i3;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/18604.cc b/libstdc++-v3/testsuite/23_containers/vector/18604.cc
new file mode 100644
index 000000000..6ebd30833
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/26412-1.cc b/libstdc++-v3/testsuite/23_containers/vector/26412-1.cc
new file mode 100644
index 000000000..dd8c1bade
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/26412-1.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// -*- C++ -*-
+
+// 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 <vector>
+
+// libstdc++26412
+namespace debug
+{
+ int i;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/26412-2.cc b/libstdc++-v3/testsuite/23_containers/vector/26412-2.cc
new file mode 100644
index 000000000..df4350dd5
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/26412-2.cc
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// -*- C++ -*-
+
+// 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/>.
+
+
+#define debug 0
+
+#include <debug/vector>
+
+// libstdc++26412
diff --git a/libstdc++-v3/testsuite/23_containers/vector/40192.cc b/libstdc++-v3/testsuite/23_containers/vector/40192.cc
new file mode 100644
index 000000000..eff88d422
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/40192.cc
@@ -0,0 +1,28 @@
+// 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/>.
+
+// { dg-do compile }
+
+// libstdc++/40192
+
+#include <vector>
+
+void test01()
+{
+ typedef float float4[4];
+ std::vector<float4> vals;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/1.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/1.cc
new file mode 100644
index 000000000..8728985e8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/1.cc
@@ -0,0 +1,36 @@
+// 2002-03-05 Stephen M. Webb <stephen.webb@bregmasoft.com>
+
+// Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.5 class vector<bool>
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ std::vector<bool>::iterator i;
+ if (false)
+ ++i;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/21244.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/21244.cc
new file mode 100644
index 000000000..f8baba1be
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/21244.cc
@@ -0,0 +1,35 @@
+// 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 <vector>
+
+// { dg-do compile }
+
+class Foo
+{
+};
+
+template<class T> Foo operator/(const Foo& arg1, T arg2)
+{
+ return Foo();
+}
+
+// libstdc++/21244
+void foo()
+{
+ std::vector<bool> bar(1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/23632.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/23632.cc
new file mode 100644
index 000000000..9b5023f98
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/23632.cc
@@ -0,0 +1,39 @@
+// 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/>.
+
+// { dg-do compile }
+
+#include <vector>
+
+// libstdc++/23632
+void test01()
+{
+ std::vector<bool> v(100);
+ const std::vector<bool>::iterator fu = v.begin();
+ if (!fu[0])
+ fu[0] = true;
+
+ const std::vector<bool>::const_iterator cfu = v.begin();
+ if (cfu[0])
+ ;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/6886.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/6886.cc
new file mode 100644
index 000000000..c3a2995ae
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/6886.cc
@@ -0,0 +1,53 @@
+// 2002-03-05 Stephen M. Webb <stephen.webb@bregmasoft.com>
+
+// Copyright (C) 2002, 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.5 class vector<bool>
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/6886
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::vector<bool> bvec;
+ int i, num = 0;
+ bvec v;
+
+ v.resize(66);
+
+ for (i = 0 ; i < 66 ; ++i)
+ v[i] = 0;
+
+ v[1] = 1;
+ v[33] = 1;
+ v[49] = 1;
+ v[65] = 1;
+
+ for (bvec::iterator j = v.begin() ; j != v.end() ; j++)
+ if (bool(*j)) ++num;
+
+ VERIFY( num == 4 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/1.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/1.cc
new file mode 100644
index 000000000..c38ac7115
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/1.cc
@@ -0,0 +1,137 @@
+// 2006-08-05 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.5 vector<bool> resize
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+const bool A1[] = {0};
+const bool A2[] = {0, 0, 0};
+const bool A3[] = {0, 0};
+const bool A4[] = {0, 0, 1, 1, 1, 1, 1};
+const bool A5[] = {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const bool A6[] = {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1};
+const bool A7[] = {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
+const bool A8[] = {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+const bool A9[] = {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const bool A10[] = {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1};
+const bool A11[] = {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0};
+
+const unsigned N1 = sizeof(A1) / sizeof(bool);
+const unsigned N2 = sizeof(A2) / sizeof(bool);
+const unsigned N3 = sizeof(A3) / sizeof(bool);
+const unsigned N4 = sizeof(A4) / sizeof(bool);
+const unsigned N5 = sizeof(A5) / sizeof(bool);
+const unsigned N6 = sizeof(A6) / sizeof(bool);
+const unsigned N7 = sizeof(A7) / sizeof(bool);
+const unsigned N8 = sizeof(A8) / sizeof(bool);
+const unsigned N9 = sizeof(A9) / sizeof(bool);
+const unsigned N10 = sizeof(A10) / sizeof(bool);
+const unsigned N11 = sizeof(A11) / sizeof(bool);
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<bool> vec_type;
+
+ vec_type v;
+
+ v.resize(1);
+ VERIFY( v.size() == 1 );
+ VERIFY( std::equal(v.begin(), v.end(), A1) );
+
+ v.resize(3);
+ VERIFY( v.size() == 3 );
+ VERIFY( std::equal(v.begin(), v.end(), A2) );
+
+ v.resize(2);
+ VERIFY( v.size() == 2 );
+ VERIFY( std::equal(v.begin(), v.end(), A3) );
+
+ v.resize(7, true);
+ VERIFY( v.size() == 7 );
+ VERIFY( std::equal(v.begin(), v.end(), A4) );
+
+ v.resize(18, false);
+ VERIFY( v.size() == 18 );
+ VERIFY( std::equal(v.begin(), v.end(), A5) );
+
+ v.resize(40, true);
+ VERIFY( v.size() == 40 );
+ VERIFY( std::equal(v.begin(), v.end(), A6) );
+
+ v.resize(80, false);
+ VERIFY( v.size() == 80 );
+ VERIFY( std::equal(v.begin(), v.end(), A7) );
+
+ v.resize(90, true);
+ VERIFY( v.size() == 90 );
+ VERIFY( std::equal(v.begin(), v.end(), A8) );
+
+ v.resize(100, false);
+ VERIFY( v.size() == 100 );
+ VERIFY( std::equal(v.begin(), v.end(), A9) );
+
+ v.resize(200, true);
+ VERIFY( v.size() == 200 );
+ VERIFY( std::equal(v.begin(), v.end(), A10) );
+
+ v.resize(13, true);
+ VERIFY( v.size() == 13 );
+ VERIFY( std::equal(v.begin(), v.end(), A11) );
+
+ v.resize(13, false);
+ VERIFY( v.size() == 13 );
+ VERIFY( std::equal(v.begin(), v.end(), A11) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/29134.cc
new file mode 100644
index 000000000..f6d0e15ed
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/29134.cc
@@ -0,0 +1,53 @@
+// Copyright (C) 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/>.
+
+// 23.2.5 class vector<bool> [lib.vector.bool]
+
+#include <vector>
+#include <limits>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using std::vector;
+ using std::numeric_limits;
+
+#ifdef _GLIBCXX_DEBUG
+ using std::_GLIBCXX_STD_C::_S_word_bit;
+#elif defined(_GLIBCXX_PROFILE)
+ using std::_GLIBCXX_STD_C::_S_word_bit;
+#else
+ using std::_S_word_bit;
+#endif
+
+ // Actually, vector<bool> is special, see libstdc++/31370.
+ vector<bool> vb;
+ typedef vector<bool>::difference_type difference_type;
+ typedef vector<bool>::size_type size_type;
+ VERIFY( vb.max_size()
+ == size_type(numeric_limits<difference_type>::max()
+ - int(_S_word_bit) + 1) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/clear_allocator.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/clear_allocator.cc
new file mode 100644
index 000000000..934f1be33
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/clear_allocator.cc
@@ -0,0 +1,87 @@
+// 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 <vector>
+#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;
+ }
+
+
+int main()
+{
+ Check_Container<std::vector<bool, clear_alloc<bool> > >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/cons/1.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/1.cc
new file mode 100644
index 000000000..ce377b466
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/1.cc
@@ -0,0 +1,178 @@
+// 2006-08-09 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.5 vector<bool> copy construct
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+const bool A1[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 1, 1};
+const bool A2[] = {1, 0, 1, 1, 1, 1, 1};
+const bool A3[] = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1};
+const bool A4[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1};
+const bool A5[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1};
+const bool A6[] = {1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1};
+const bool A7[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 0};
+const bool A8[] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0};
+const bool A9[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0};
+
+const unsigned N1 = sizeof(A1) / sizeof(bool);
+const unsigned N2 = sizeof(A2) / sizeof(bool);
+const unsigned N3 = sizeof(A3) / sizeof(bool);
+const unsigned N4 = sizeof(A4) / sizeof(bool);
+const unsigned N5 = sizeof(A5) / sizeof(bool);
+const unsigned N6 = sizeof(A6) / sizeof(bool);
+const unsigned N7 = sizeof(A7) / sizeof(bool);
+const unsigned N8 = sizeof(A8) / sizeof(bool);
+const unsigned N9 = sizeof(A9) / sizeof(bool);
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<bool> vec_type;
+
+ const vec_type v1_ref(A1, A1 + N1);
+ vec_type v1(v1_ref);
+ VERIFY( v1.size() == v1_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v1_ref.begin()) );
+
+ const vec_type v2_ref(A2, A2 + N2);
+ vec_type v2(v2_ref);
+ VERIFY( v2.size() == v2_ref.size() );
+ VERIFY( std::equal(v2.begin(), v2.end(), v2_ref.begin()) );
+
+ const vec_type v3_ref(A3, A3 + N3);
+ vec_type v3(v3_ref);
+ VERIFY( v3.size() == v3_ref.size() );
+ VERIFY( std::equal(v3.begin(), v3.end(), v3_ref.begin()) );
+
+ const vec_type v4_ref(A4, A4 + N4);
+ vec_type v4(v4_ref);
+ VERIFY( v4.size() == v4_ref.size() );
+ VERIFY( std::equal(v4.begin(), v4.end(), v4_ref.begin()) );
+
+ const vec_type v5_ref(A5, A5 + N5);
+ vec_type v5(v5_ref);
+ VERIFY( v5.size() == v5_ref.size() );
+ VERIFY( std::equal(v5.begin(), v5.end(), v5_ref.begin()) );
+
+ const vec_type v6_ref(A6, A6 + N6);
+ vec_type v6(v6_ref);
+ VERIFY( v6.size() == v6_ref.size() );
+ VERIFY( std::equal(v6.begin(), v6.end(), v6_ref.begin()) );
+
+ const vec_type v7_ref(A7, A7 + N7);
+ vec_type v7(v7_ref);
+ VERIFY( v7.size() == v7_ref.size() );
+ VERIFY( std::equal(v7.begin(), v7.end(), v7_ref.begin()) );
+
+ const vec_type v8_ref(A8, A8 + N8);
+ vec_type v8(v8_ref);
+ VERIFY( v8.size() == v8_ref.size() );
+ VERIFY( std::equal(v8.begin(), v8.end(), v8_ref.begin()) );
+
+ const vec_type v9_ref(A9, A9 + N9);
+ vec_type v9(v9_ref);
+ VERIFY( v9.size() == v9_ref.size() );
+ VERIFY( std::equal(v9.begin(), v9.end(), v9_ref.begin()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/cons/2.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/2.cc
new file mode 100644
index 000000000..34ac3a0fd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/2.cc
@@ -0,0 +1,180 @@
+// 2006-08-09 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.5 vector<bool> assignment operator
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+const bool A1[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 1, 1};
+const bool A2[] = {1, 0, 1, 1, 1, 1, 1};
+const bool A3[] = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1};
+const bool A4[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1};
+const bool A5[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1};
+const bool A6[] = {1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1};
+const bool A7[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 0};
+const bool A8[] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0};
+const bool A9[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0};
+
+const unsigned N1 = sizeof(A1) / sizeof(bool);
+const unsigned N2 = sizeof(A2) / sizeof(bool);
+const unsigned N3 = sizeof(A3) / sizeof(bool);
+const unsigned N4 = sizeof(A4) / sizeof(bool);
+const unsigned N5 = sizeof(A5) / sizeof(bool);
+const unsigned N6 = sizeof(A6) / sizeof(bool);
+const unsigned N7 = sizeof(A7) / sizeof(bool);
+const unsigned N8 = sizeof(A8) / sizeof(bool);
+const unsigned N9 = sizeof(A9) / sizeof(bool);
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<bool> vec_type;
+
+ vec_type v1;
+
+ const vec_type v1_ref(A1, A1 + N1);
+ v1 = v1_ref;
+ VERIFY( v1.size() == v1_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v1_ref.begin()) );
+
+ const vec_type v2_ref(A2, A2 + N2);
+ v1 = v2_ref;
+ VERIFY( v1.size() == v2_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v2_ref.begin()) );
+
+ const vec_type v3_ref(A3, A3 + N3);
+ v1 = v3_ref;
+ VERIFY( v1.size() == v3_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v3_ref.begin()) );
+
+ const vec_type v4_ref(A4, A4 + N4);
+ v1 = v4_ref;
+ VERIFY( v1.size() == v4_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v4_ref.begin()) );
+
+ const vec_type v5_ref(A5, A5 + N5);
+ v1 = v5_ref;
+ VERIFY( v1.size() == v5_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v5_ref.begin()) );
+
+ const vec_type v6_ref(A6, A6 + N6);
+ v1 = v6_ref;
+ VERIFY( v1.size() == v6_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v6_ref.begin()) );
+
+ const vec_type v7_ref(A7, A7 + N7);
+ v1 = v7_ref;
+ VERIFY( v1.size() == v7_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v7_ref.begin()) );
+
+ const vec_type v8_ref(A8, A8 + N8);
+ v1 = v8_ref;
+ VERIFY( v1.size() == v8_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v8_ref.begin()) );
+
+ const vec_type v9_ref(A9, A9 + N9);
+ v1 = v9_ref;
+ VERIFY( v1.size() == v9_ref.size() );
+ VERIFY( std::equal(v1.begin(), v1.end(), v9_ref.begin()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/hash/1.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/hash/1.cc
new file mode 100644
index 000000000..85e91e98e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/hash/1.cc
@@ -0,0 +1,45 @@
+// { 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/>.
+
+#include <vector>
+
+void test01()
+{
+ std::vector<bool> b0;
+ std::hash<std::vector<bool>> h0;
+ h0(b0);
+
+ std::vector<bool> b1(10);
+ std::hash<std::vector<bool>> h1;
+ h1(b1);
+
+ std::vector<bool> b2(100);
+ std::hash<std::vector<bool>> h2;
+ h2(b2);
+
+ std::vector<bool> b3(1000);
+ std::hash<std::vector<bool>> h3;
+ h3(b3);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/erase/1.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/erase/1.cc
new file mode 100644
index 000000000..2a21fcf9e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/erase/1.cc
@@ -0,0 +1,136 @@
+// 2005-12-23 Paolo Carlini <pcarlini@suse.de>
+
+// 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.5 vector<bool> modifiers
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+const bool A[] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
+const bool A1[] = {0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
+const bool A2[] = {0, 0, 1, 0, 0, 1, 0, 1, 0, 1};
+const bool A3[] = {0, 0, 1, 0, 0, 1};
+const bool A4[] = {0, 0, 1};
+const bool A5[] = {0, 0};
+
+const unsigned N = sizeof(A) / sizeof(bool);
+const unsigned N1 = sizeof(A1) / sizeof(bool);
+const unsigned N2 = sizeof(A2) / sizeof(bool);
+const unsigned N3 = sizeof(A3) / sizeof(bool);
+const unsigned N4 = sizeof(A4) / sizeof(bool);
+const unsigned N5 = sizeof(A5) / sizeof(bool);
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<bool> vec_type;
+ typedef vec_type::iterator iterator_type;
+
+ vec_type v(A, A + N);
+
+ iterator_type it1 = v.erase(v.begin() + 1);
+ VERIFY( it1 == v.begin() + 1 );
+ VERIFY( v.size() == N1 );
+ VERIFY( std::equal(v.begin(), v.end(), A1) );
+
+ iterator_type it2 = v.erase(v.begin() + 4, v.begin() + 9);
+ VERIFY( it2 == v.begin() + 4 );
+ VERIFY( v.size() == N2 );
+ VERIFY( std::equal(v.begin(), v.end(), A2) );
+
+ iterator_type it3 = v.erase(v.begin() + 6, v.end());
+ VERIFY( it3 == v.begin() + 6 );
+ VERIFY( v.size() == N3 );
+ VERIFY( std::equal(v.begin(), v.end(), A3) );
+
+ iterator_type it4 = v.erase(v.begin(), v.begin() + 3);
+ VERIFY( it4 == v.begin() );
+ VERIFY( v.size() == N4 );
+ VERIFY( std::equal(v.begin(), v.end(), A4) );
+
+ iterator_type it5 = v.erase(v.begin() + 2);
+ VERIFY( it5 == v.begin() + 2 );
+ VERIFY( v.size() == N5 );
+ VERIFY( std::equal(v.begin(), v.end(), A5) );
+
+ iterator_type it6 = v.erase(v.begin(), v.end());
+ VERIFY( it6 == v.begin() );
+ VERIFY( v.empty() );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<std::vector<bool> > vec_type;
+ typedef vec_type::iterator iterator_type;
+
+ vec_type v, v1, v2, v3, v4, v5;
+ for (unsigned i = 0; i < N; ++i)
+ v.push_back(std::vector<bool>(1, A[i]));
+ for (unsigned i = 0; i < N1; ++i)
+ v1.push_back(std::vector<bool>(1, A1[i]));
+ for (unsigned i = 0; i < N2; ++i)
+ v2.push_back(std::vector<bool>(1, A2[i]));
+ for (unsigned i = 0; i < N3; ++i)
+ v3.push_back(std::vector<bool>(1, A3[i]));
+ for (unsigned i = 0; i < N4; ++i)
+ v4.push_back(std::vector<bool>(1, A4[i]));
+ for (unsigned i = 0; i < N5; ++i)
+ v5.push_back(std::vector<bool>(1, A5[i]));
+
+ iterator_type it1 = v.erase(v.begin() + 1);
+ VERIFY( it1 == v.begin() + 1 );
+ VERIFY( v.size() == N1 );
+ VERIFY( std::equal(v.begin(), v.end(), v1.begin()) );
+
+ iterator_type it2 = v.erase(v.begin() + 4, v.begin() + 9);
+ VERIFY( it2 == v.begin() + 4 );
+ VERIFY( v.size() == N2 );
+ VERIFY( std::equal(v.begin(), v.end(), v2.begin()) );
+
+ iterator_type it3 = v.erase(v.begin() + 6, v.end());
+ VERIFY( it3 == v.begin() + 6 );
+ VERIFY( v.size() == N3 );
+ VERIFY( std::equal(v.begin(), v.end(), v3.begin()) );
+
+ iterator_type it4 = v.erase(v.begin(), v.begin() + 3);
+ VERIFY( it4 == v.begin() );
+ VERIFY( v.size() == N4 );
+ VERIFY( std::equal(v.begin(), v.end(), v4.begin()) );
+
+ iterator_type it5 = v.erase(v.begin() + 2);
+ VERIFY( it5 == v.begin() + 2 );
+ VERIFY( v.size() == N5 );
+ VERIFY( std::equal(v.begin(), v.end(), v5.begin()) );
+
+ iterator_type it6 = v.erase(v.begin(), v.end());
+ VERIFY( it6 == v.begin() );
+ VERIFY( v.empty() );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/1.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/1.cc
new file mode 100644
index 000000000..06fe0be97
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/1.cc
@@ -0,0 +1,171 @@
+// 2006-08-05 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.5 vector<bool> insert
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+const bool A1[] = {1, 1, 1, 1, 1, 1, 1};
+const bool A2[] = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1};
+const bool A3[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1};
+const bool A4[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1};
+const bool A5[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1};
+const bool A6[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1};
+const bool A7[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 0};
+const bool A8[] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0};
+const bool A9[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0};
+
+const unsigned N1 = sizeof(A1) / sizeof(bool);
+const unsigned N2 = sizeof(A2) / sizeof(bool);
+const unsigned N3 = sizeof(A3) / sizeof(bool);
+const unsigned N4 = sizeof(A4) / sizeof(bool);
+const unsigned N5 = sizeof(A5) / sizeof(bool);
+const unsigned N6 = sizeof(A6) / sizeof(bool);
+const unsigned N7 = sizeof(A7) / sizeof(bool);
+const unsigned N8 = sizeof(A8) / sizeof(bool);
+const unsigned N9 = sizeof(A9) / sizeof(bool);
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<bool> vec_type;
+
+ vec_type v;
+
+ v.insert(v.begin(), 7, true);
+ VERIFY( v.size() == 7 );
+ VERIFY( std::equal(v.begin(), v.end(), A1) );
+
+ v.insert(v.begin() + 5, 10, false);
+ VERIFY( v.size() == 17 );
+ VERIFY( std::equal(v.begin(), v.end(), A2) );
+
+ v.insert(v.begin(), 20, false);
+ VERIFY( v.size() == 37 );
+ VERIFY( std::equal(v.begin(), v.end(), A3) );
+
+ v.insert(v.begin(), 40, true);
+ VERIFY( v.size() == 77 );
+ VERIFY( std::equal(v.begin(), v.end(), A4) );
+
+ v.insert(v.begin() + 18, 80, false);
+ VERIFY( v.size() == 157 );
+ VERIFY( std::equal(v.begin(), v.end(), A5) );
+
+ v.insert(v.begin() + 54, 80, true);
+ VERIFY( v.size() == 237 );
+ VERIFY( std::equal(v.begin(), v.end(), A6) );
+
+ v.insert(v.end(), 1, false);
+ VERIFY( v.size() == 238 );
+ VERIFY( std::equal(v.begin(), v.end(), A7) );
+
+ v.insert(v.begin(), 1, false);
+ VERIFY( v.size() == 239 );
+ VERIFY( std::equal(v.begin(), v.end(), A8) );
+
+ v.insert(v.begin(), 180, true);
+ VERIFY( v.size() == 419 );
+ VERIFY( std::equal(v.begin(), v.end(), A9) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc
new file mode 100644
index 000000000..9f5643ef9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc
@@ -0,0 +1,199 @@
+// Copyright (C) 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/>.
+
+// 23.2.5 class vector<bool> [lib.vector.bool]
+
+// { dg-do run { xfail *-*-darwin8.[0-4].* } }
+
+#include <vector>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+#ifdef _GLIBCXX_DEBUG
+ using std::_GLIBCXX_STD_C::_S_word_bit;
+#elif defined(_GLIBCXX_PROFILE)
+ using std::_GLIBCXX_STD_C::_S_word_bit;
+#else
+ using std::_S_word_bit;
+#endif
+
+inline void
+check_cap_ge_size(const std::vector<bool>& x)
+{
+ if (x.capacity() < x.size())
+ throw std::logic_error("");
+}
+
+inline void
+check_cap_eq_maxsize(const std::vector<bool>& x)
+{
+ if (x.capacity() != x.max_size())
+ throw std::logic_error("");
+}
+
+// libstdc++/31370
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ int myexit = 0;
+
+ try
+ {
+ std::vector<bool> x;
+ x.reserve(x.max_size());
+ check_cap_eq_maxsize(x);
+ }
+ catch(std::bad_alloc&)
+ { }
+ catch(std::exception&)
+ { ++myexit; }
+
+ // When doubling is too big, but smaller is sufficient, the resize
+ // should do smaller and be happy. It certainly shouldn't throw
+ // other exceptions or crash.
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() / 2 + 1, false);
+ for(int i = 0; i < _S_word_bit; ++i)
+ x.push_back(false);
+ check_cap_ge_size(x);
+ }
+ catch(std::bad_alloc&)
+ { }
+ catch(std::exception&)
+ { ++myexit; }
+
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() / 2 + 1, false);
+ x.insert(x.end(), _S_word_bit, false);
+ check_cap_ge_size(x);
+ }
+ catch(std::bad_alloc&)
+ { }
+ catch(std::exception&)
+ { ++myexit; }
+
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() / 2 + 1, false);
+ std::vector<bool> y(_S_word_bit, false);
+ x.insert(x.end(), y.begin(), y.end());
+ check_cap_ge_size(x);
+ }
+ catch(std::bad_alloc&)
+ { }
+ catch(std::exception&)
+ { ++myexit; }
+
+ // These tests are currently only relevant to bool: don't get burned
+ // by the attempt to round up when near the max size.
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() - _S_word_bit, false);
+ for(int i = 0; i < _S_word_bit; ++i)
+ x.push_back(false);
+ check_cap_ge_size(x);
+ }
+ catch(std::bad_alloc&)
+ { }
+ catch(std::exception&)
+ { ++myexit; }
+
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() - _S_word_bit, false);
+ x.insert(x.end(), _S_word_bit, false);
+ check_cap_ge_size(x);
+ }
+ catch(std::bad_alloc&)
+ { }
+ catch(std::exception&)
+ { ++myexit; }
+
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() - _S_word_bit, false);
+ std::vector<bool> y(_S_word_bit, false);
+ x.insert(x.end(), y.begin(), y.end());
+ check_cap_ge_size(x);
+ }
+ catch(std::bad_alloc&)
+ { }
+ catch(std::exception&)
+ { ++myexit; }
+
+ // Attempts to put in more than max_size() items should result in a
+ // length error.
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() - _S_word_bit, false);
+ for(int i = 0; i < _S_word_bit + 1; ++i)
+ x.push_back(false);
+ ++myexit;
+ }
+ catch(std::bad_alloc)
+ { }
+ catch(std::length_error)
+ { }
+ catch(std::exception)
+ { ++myexit; }
+
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() - _S_word_bit, false);
+ x.insert(x.end(), _S_word_bit + 1, false);
+ ++myexit;
+ }
+ catch(std::bad_alloc)
+ { }
+ catch(std::length_error)
+ { }
+ catch(std::exception)
+ { ++myexit; }
+
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() - _S_word_bit, false);
+ std::vector<bool> y(_S_word_bit + 1, false);
+ x.insert(x.end(), y.begin(), y.end());
+ ++myexit;
+ }
+ catch(std::bad_alloc)
+ { }
+ catch(std::length_error)
+ { }
+ catch(std::exception)
+ { ++myexit; }
+
+ VERIFY( !myexit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/swap/1.cc
new file mode 100644
index 000000000..31152845b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/swap/1.cc
@@ -0,0 +1,145 @@
+// 2005-12-23 Paolo Carlini <pcarlini@suse.de>
+
+// 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.5 vector<bool>::swap
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator as a non-empty allocator.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef __gnu_test::uneq_allocator<bool> my_alloc;
+ typedef vector<bool, my_alloc> my_vector;
+
+ 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);
+
+ vector<bool> vec01_ref;
+ for (size_t i = 0; i < N1; ++i)
+ vec01_ref.push_back(bool(title01[i] > 96 ? 1 : 0));
+ vector<bool> vec02_ref;
+ for (size_t i = 0; i < N2; ++i)
+ vec02_ref.push_back(bool(title02[i] > 96 ? 1 : 0));
+ vector<bool> vec03_ref;
+ for (size_t i = 0; i < N3; ++i)
+ vec03_ref.push_back(bool(title03[i] > 96 ? 1 : 0));
+ vector<bool> vec04_ref;
+ for (size_t i = 0; i < N4; ++i)
+ vec04_ref.push_back(bool(title04[i] > 96 ? 1 : 0));
+
+ my_vector::size_type size01, size02;
+
+ my_alloc alloc01(1);
+
+ my_vector vec01(alloc01);
+ size01 = vec01.size();
+ my_vector vec02(alloc01);
+ size02 = vec02.size();
+
+ vec01.swap(vec02);
+ VERIFY( vec01.size() == size02 );
+ VERIFY( vec01.empty() );
+ VERIFY( vec02.size() == size01 );
+ VERIFY( vec02.empty() );
+
+ my_vector vec03(alloc01);
+ size01 = vec03.size();
+ my_vector vec04(vec02_ref.begin(), vec02_ref.end(), alloc01);
+ size02 = vec04.size();
+
+ vec03.swap(vec04);
+ VERIFY( vec03.size() == size02 );
+ VERIFY( equal(vec03.begin(), vec03.end(), vec02_ref.begin()) );
+ VERIFY( vec04.size() == size01 );
+ VERIFY( vec04.empty() );
+
+ my_vector vec05(vec01_ref.begin(), vec01_ref.end(), alloc01);
+ size01 = vec05.size();
+ my_vector vec06(vec02_ref.begin(), vec02_ref.end(), alloc01);
+ size02 = vec06.size();
+
+ vec05.swap(vec06);
+ VERIFY( vec05.size() == size02 );
+ VERIFY( equal(vec05.begin(), vec05.end(), vec02_ref.begin()) );
+ VERIFY( vec06.size() == size01 );
+ VERIFY( equal(vec06.begin(), vec06.end(), vec01_ref.begin()) );
+
+ my_vector vec07(vec01_ref.begin(), vec01_ref.end(), alloc01);
+ size01 = vec07.size();
+ my_vector vec08(vec03_ref.begin(), vec03_ref.end(), alloc01);
+ size02 = vec08.size();
+
+ vec07.swap(vec08);
+ VERIFY( vec07.size() == size02 );
+ VERIFY( equal(vec07.begin(), vec07.end(), vec03_ref.begin()) );
+ VERIFY( vec08.size() == size01 );
+ VERIFY( equal(vec08.begin(), vec08.end(), vec01_ref.begin()) );
+
+ my_vector vec09(vec03_ref.begin(), vec03_ref.end(), alloc01);
+ size01 = vec09.size();
+ my_vector vec10(vec04_ref.begin(), vec04_ref.end(), alloc01);
+ size02 = vec10.size();
+
+ vec09.swap(vec10);
+ VERIFY( vec09.size() == size02 );
+ VERIFY( equal(vec09.begin(), vec09.end(), vec04_ref.begin()) );
+ VERIFY( vec10.size() == size01 );
+ VERIFY( equal(vec10.begin(), vec10.end(), vec03_ref.begin()) );
+
+ my_vector vec11(vec04_ref.begin(), vec04_ref.end(), alloc01);
+ size01 = vec11.size();
+ my_vector vec12(vec01_ref.begin(), vec01_ref.end(), alloc01);
+ size02 = vec12.size();
+
+ vec11.swap(vec12);
+ VERIFY( vec11.size() == size02 );
+ VERIFY( equal(vec11.begin(), vec11.end(), vec01_ref.begin()) );
+ VERIFY( vec12.size() == size01 );
+ VERIFY( equal(vec12.begin(), vec12.end(), vec04_ref.begin()) );
+
+ my_vector vec13(vec03_ref.begin(), vec03_ref.end(), alloc01);
+ size01 = vec13.size();
+ my_vector vec14(vec03_ref.begin(), vec03_ref.end(), alloc01);
+ size02 = vec14.size();
+
+ vec13.swap(vec14);
+ VERIFY( vec13.size() == size02 );
+ VERIFY( equal(vec13.begin(), vec13.end(), vec03_ref.begin()) );
+ VERIFY( vec14.size() == size01 );
+ VERIFY( equal(vec14.begin(), vec14.end(), vec03_ref.begin()) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/swap/2.cc
new file mode 100644
index 000000000..f63b6a257
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/swap/2.cc
@@ -0,0 +1,174 @@
+// 2005-12-23 Paolo Carlini <pcarlini@suse.de>
+
+// 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.5 vector<bool>::swap
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator, two different personalities.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef __gnu_test::uneq_allocator<bool> my_alloc;
+ typedef vector<bool, my_alloc> my_vector;
+
+ 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);
+
+ vector<bool> vec01_ref;
+ for (size_t i = 0; i < N1; ++i)
+ vec01_ref.push_back(bool(title01[i] > 96 ? 1 : 0));
+ vector<bool> vec02_ref;
+ for (size_t i = 0; i < N2; ++i)
+ vec02_ref.push_back(bool(title02[i] > 96 ? 1 : 0));
+ vector<bool> vec03_ref;
+ for (size_t i = 0; i < N3; ++i)
+ vec03_ref.push_back(bool(title03[i] > 96 ? 1 : 0));
+ vector<bool> vec04_ref;
+ for (size_t i = 0; i < N4; ++i)
+ vec04_ref.push_back(bool(title04[i] > 96 ? 1 : 0));
+
+ my_vector::size_type size01, size02;
+
+ my_alloc alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ my_vector vec01(alloc01);
+ size01 = vec01.size();
+ personality01 = vec01.get_allocator().get_personality();
+ my_vector vec02(alloc02);
+ size02 = vec02.size();
+ personality02 = vec02.get_allocator().get_personality();
+
+ vec01.swap(vec02);
+ VERIFY( vec01.size() == size02 );
+ VERIFY( vec01.empty() );
+ VERIFY( vec02.size() == size01 );
+ VERIFY( vec02.empty() );
+ VERIFY( vec01.get_allocator().get_personality() == personality02 );
+ VERIFY( vec02.get_allocator().get_personality() == personality01 );
+
+ my_vector vec03(alloc02);
+ size01 = vec03.size();
+ personality01 = vec03.get_allocator().get_personality();
+ my_vector vec04(vec02_ref.begin(), vec02_ref.end(), alloc01);
+ size02 = vec04.size();
+ personality02 = vec04.get_allocator().get_personality();
+
+ vec03.swap(vec04);
+ VERIFY( vec03.size() == size02 );
+ VERIFY( equal(vec03.begin(), vec03.end(), vec02_ref.begin()) );
+ VERIFY( vec04.size() == size01 );
+ VERIFY( vec04.empty() );
+ VERIFY( vec03.get_allocator().get_personality() == personality02 );
+ VERIFY( vec04.get_allocator().get_personality() == personality01 );
+
+ my_vector vec05(vec01_ref.begin(), vec01_ref.end(), alloc01);
+ size01 = vec05.size();
+ personality01 = vec05.get_allocator().get_personality();
+ my_vector vec06(vec02_ref.begin(), vec02_ref.end(), alloc02);
+ size02 = vec06.size();
+ personality02 = vec06.get_allocator().get_personality();
+
+ vec05.swap(vec06);
+ VERIFY( vec05.size() == size02 );
+ VERIFY( equal(vec05.begin(), vec05.end(), vec02_ref.begin()) );
+ VERIFY( vec06.size() == size01 );
+ VERIFY( equal(vec06.begin(), vec06.end(), vec01_ref.begin()) );
+ VERIFY( vec05.get_allocator().get_personality() == personality02 );
+ VERIFY( vec06.get_allocator().get_personality() == personality01 );
+
+ my_vector vec07(vec01_ref.begin(), vec01_ref.end(), alloc02);
+ size01 = vec07.size();
+ personality01 = vec07.get_allocator().get_personality();
+ my_vector vec08(vec03_ref.begin(), vec03_ref.end(), alloc01);
+ size02 = vec08.size();
+ personality02 = vec08.get_allocator().get_personality();
+
+ vec07.swap(vec08);
+ VERIFY( vec07.size() == size02 );
+ VERIFY( equal(vec07.begin(), vec07.end(), vec03_ref.begin()) );
+ VERIFY( vec08.size() == size01 );
+ VERIFY( equal(vec08.begin(), vec08.end(), vec01_ref.begin()) );
+ VERIFY( vec07.get_allocator().get_personality() == personality02 );
+ VERIFY( vec08.get_allocator().get_personality() == personality01 );
+
+ my_vector vec09(vec03_ref.begin(), vec03_ref.end(), alloc01);
+ size01 = vec09.size();
+ personality01 = vec09.get_allocator().get_personality();
+ my_vector vec10(vec04_ref.begin(), vec04_ref.end(), alloc02);
+ size02 = vec10.size();
+ personality02 = vec10.get_allocator().get_personality();
+
+ vec09.swap(vec10);
+ VERIFY( vec09.size() == size02 );
+ VERIFY( equal(vec09.begin(), vec09.end(), vec04_ref.begin()) );
+ VERIFY( vec10.size() == size01 );
+ VERIFY( equal(vec10.begin(), vec10.end(), vec03_ref.begin()) );
+ VERIFY( vec09.get_allocator().get_personality() == personality02 );
+ VERIFY( vec10.get_allocator().get_personality() == personality01 );
+
+ my_vector vec11(vec04_ref.begin(), vec04_ref.end(), alloc02);
+ size01 = vec11.size();
+ personality01 = vec11.get_allocator().get_personality();
+ my_vector vec12(vec01_ref.begin(), vec01_ref.end(), alloc01);
+ size02 = vec12.size();
+ personality02 = vec12.get_allocator().get_personality();
+
+ vec11.swap(vec12);
+ VERIFY( vec11.size() == size02 );
+ VERIFY( equal(vec11.begin(), vec11.end(), vec01_ref.begin()) );
+ VERIFY( vec12.size() == size01 );
+ VERIFY( equal(vec12.begin(), vec12.end(), vec04_ref.begin()) );
+ VERIFY( vec11.get_allocator().get_personality() == personality02 );
+ VERIFY( vec12.get_allocator().get_personality() == personality01 );
+
+ my_vector vec13(vec03_ref.begin(), vec03_ref.end(), alloc01);
+ size01 = vec13.size();
+ personality01 = vec13.get_allocator().get_personality();
+ my_vector vec14(vec03_ref.begin(), vec03_ref.end(), alloc02);
+ size02 = vec14.size();
+ personality02 = vec14.get_allocator().get_personality();
+
+ vec13.swap(vec14);
+ VERIFY( vec13.size() == size02 );
+ VERIFY( equal(vec13.begin(), vec13.end(), vec03_ref.begin()) );
+ VERIFY( vec14.size() == size01 );
+ VERIFY( equal(vec14.begin(), vec14.end(), vec03_ref.begin()) );
+ VERIFY( vec13.get_allocator().get_personality() == personality02 );
+ VERIFY( vec14.get_allocator().get_personality() == personality01 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc
new file mode 100644
index 000000000..9f4783b74
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/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 <vector>
+#include <testsuite_containers.h>
+
+int main()
+{
+ typedef std::vector<bool> test_type;
+ __gnu_test::citerator<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/dr438/constructor.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/dr438/constructor.cc
new file mode 100644
index 000000000..9a815ec7d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/dr438/constructor.cc
@@ -0,0 +1,27 @@
+// 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 <vector>
+
+void f()
+{
+ std::vector<bool> vb(10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/1.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/1.cc
new file mode 100644
index 000000000..557b329f3
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/1.cc
@@ -0,0 +1,61 @@
+// 1999-05-07
+// bkoz
+
+// Copyright (C) 1999, 2002, 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.4.2 vector capacity
+
+#include <vector>
+#include <stdexcept>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+void test01()
+{
+ // non POD types
+ bool test __attribute__((unused)) = true;
+ std::vector< A<B> > vec01;
+ typedef std::vector< A<B> >::size_type size_type;
+
+ size_type sz01 = vec01.capacity();
+ vec01.reserve(100);
+ size_type sz02 = vec01.capacity();
+ VERIFY( sz02 >= sz01 );
+
+ sz01 = vec01.size() + 5;
+ vec01.resize(sz01);
+ sz02 = vec01.size();
+ VERIFY( sz01 == sz02 );
+
+ sz01 = vec01.size() - 5;
+ vec01.resize(sz01);
+ sz02 = vec01.size();
+ VERIFY( sz01 == sz02 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/2.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/2.cc
new file mode 100644
index 000000000..1cf0cae98
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/2.cc
@@ -0,0 +1,102 @@
+// 1999-05-07
+// bkoz
+
+// Copyright (C) 1999, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.4.2 vector capacity
+
+#include <vector>
+#include <stdexcept>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+using __gnu_test::copy_tracker;
+using __gnu_test::tracker_allocator_counter;
+using __gnu_test::tracker_allocator;
+using __gnu_test::copy_constructor;
+using __gnu_test::assignment_operator;
+using __gnu_test::destructor;
+
+// Verifies basic functionality of reserve() with forced reallocation.
+void
+test_reserve()
+{
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X a(3);
+ const X::size_type old_size = a.size();
+ const X::size_type old_capacity = a.capacity();
+ const X::size_type new_capacity = old_capacity + 10;
+ T::reset();
+
+ a.reserve(new_capacity);
+
+ // [23.2.4.1 (2)]
+ VERIFY(new_capacity <= a.capacity());
+ // [23.2.4.1 (3)]
+ VERIFY(old_size == a.size());
+ VERIFY(copy_constructor::count() <= old_size);
+ VERIFY(destructor::count() <= old_size);
+ }
+ // check for memory leaks
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+}
+
+// Verifies that reserve() with reallocation offers the strong
+// exception guarantee.
+void
+test_reserve_exception_guarantee()
+{
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X a(7);
+ const X::size_type old_size __attribute__((unused)) = a.size();
+ const X::size_type old_capacity = a.capacity();
+ const X::size_type new_capacity = old_capacity + 10;
+ T::reset();
+ copy_constructor::throw_on(3);
+
+ try
+ {
+ a.reserve(new_capacity);
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ }
+
+ VERIFY(old_capacity == a.capacity());
+ VERIFY(copy_constructor::count() == destructor::count()+1);
+ }
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+}
+
+int main()
+{
+ test_reserve();
+ test_reserve_exception_guarantee();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/29134-2.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/29134-2.cc
new file mode 100644
index 000000000..c48e474e9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/29134-2.cc
@@ -0,0 +1,50 @@
+// 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.4.2 vector capacity [lib.vector.capacity]
+
+#include <vector>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ vector<int> v;
+
+ try
+ {
+ v.resize(size_t(-1));
+ }
+ catch(const std::length_error&)
+ {
+ VERIFY( true );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/29134.cc
new file mode 100644
index 000000000..72fac56c2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/29134.cc
@@ -0,0 +1,37 @@
+// 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.4.2 vector capacity [lib.vector.capacity]
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<int> v;
+
+ VERIFY( v.max_size() == v.get_allocator().max_size() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/44190.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/44190.cc
new file mode 100644
index 000000000..737108b49
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/44190.cc
@@ -0,0 +1,38 @@
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/44190
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<int> v;
+ v.resize(10);
+ VERIFY( v.size() <= v.capacity() );
+}
+
+int main()
+{
+
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/8230.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/8230.cc
new file mode 100644
index 000000000..b1b2c7d48
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/8230.cc
@@ -0,0 +1,78 @@
+// 1999-05-07
+// bkoz
+
+// Copyright (C) 1999, 2002, 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.4.2 vector capacity
+
+#include <vector>
+#include <stdexcept>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+// libstdc++/8230
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ {
+ std::vector<int> array;
+ const std::size_t size = array.max_size();
+ try
+ {
+ array.reserve(size);
+ }
+ catch (const std::length_error& error)
+ {
+ test &= false;
+ }
+ catch (const std::bad_alloc& error)
+ {
+ test &= true;
+ }
+ catch (...)
+ {
+ test &= false;
+ }
+ VERIFY( test );
+ }
+
+ {
+ std::vector<int> array;
+ const std::size_t size = array.max_size() + 1;
+ try
+ {
+ array.reserve(size);
+ }
+ catch (const std::length_error& error)
+ {
+ test &= true;
+ }
+ catch (...)
+ {
+ test &= false;
+ }
+ VERIFY( test );
+ }
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/reserve/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/reserve/moveable.cc
new file mode 100644
index 000000000..c8ce77b63
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/reserve/moveable.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-28 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 <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace __gnu_test;
+
+ std::vector<copycounter> a(40);
+ copycounter::copycount = 0;
+
+ a.reserve(50);
+ VERIFY( copycounter::copycount == 0 );
+
+ a.reserve(200);
+ VERIFY( copycounter::copycount == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc
new file mode 100644
index 000000000..168df7a4a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc
@@ -0,0 +1,60 @@
+// 1999-05-07
+// bkoz
+
+// Copyright (C) 1999, 2002, 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.4.2 vector capacity
+
+// XXX This test will not work for irix6 because of bug(s) in libc malloc
+// XXX for very large allocations. However -lmalloc seems to work.
+// See http://gcc.gnu.org/ml/libstdc++/2002-12/msg00131.html
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
+
+// This fails on some versions of Darwin 8 because malloc doesn't return
+// NULL even if an allocation fails (filed as Radar 3884894).
+// { dg-do run { xfail *-*-darwin8.[0-4].* } }
+
+#include <vector>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::vector<int> v;
+ try
+ {
+ v.resize(v.max_size());
+ v[v.max_size() - 1] = 2002;
+ }
+ catch (const std::bad_alloc& error)
+ {
+ test = true;
+ }
+ catch (...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc
new file mode 100644
index 000000000..5ba026dbe
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc
@@ -0,0 +1,56 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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/>.
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+using namespace __gnu_test;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<copycounter> a;
+ copycounter::copycount = 0;
+ a.resize(10);
+ a.resize(98);
+ a.resize(99);
+ a.resize(100);
+ VERIFY( copycounter::copycount == 0 );
+
+ a.resize(99);
+ a.resize(0);
+ VERIFY( copycounter::copycount == 0 );
+
+ a.resize(100);
+ VERIFY( copycounter::copycount == 0 );
+
+ a.clear();
+ VERIFY( copycounter::copycount == 0 );
+}
+
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc
new file mode 100644
index 000000000..d181168ac
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/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 <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<__gnu_test::NonCopyConstructible> v;
+ VERIFY( std::distance(v.begin(), v.end()) == 0 );
+
+ v.resize(1000);
+ VERIFY( std::distance(v.begin(), v.end()) == 1000 );
+ for(auto it = v.begin(); it != v.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc
new file mode 100644
index 000000000..482166cab
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-01-08 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 <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/42573
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<int> v(100);
+ v.push_back(1);
+ v.push_back(1);
+ VERIFY( v.size() < v.capacity() );
+ v.shrink_to_fit();
+ VERIFY( v.size() == v.capacity() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/check_construct_destroy.cc b/libstdc++-v3/testsuite/23_containers/vector/check_construct_destroy.cc
new file mode 100644
index 000000000..d84228c88
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/check_construct_destroy.cc
@@ -0,0 +1,76 @@
+// 2004-07-26 Matt Austern <austern@apple.com>
+//
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <vector>
+#include <testsuite_allocator.h>
+
+using namespace __gnu_test;
+
+int main()
+{
+ typedef std::vector<int, tracker_allocator<int> > Container;
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ Container c;
+ ok = check_construct_destroy("empty container", 0, 0) && ok;
+ }
+ ok = check_construct_destroy("empty container", 0, 0) && ok;
+
+
+ tracker_allocator_counter::reset();
+ {
+ Container c(arr10, arr10 + 10);
+ ok = check_construct_destroy("Construct from range", 10, 0) && ok;
+ }
+ ok = check_construct_destroy("Construct from range", 10, 10) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ c.reserve(100);
+ 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;
+
+ {
+ Container c(arr10, arr10 + 10);
+ c.reserve(100);
+ tracker_allocator_counter::reset();
+ c.insert(c.begin() + 5, arr10, arr10+3);
+ ok = check_construct_destroy("Insert short range", 3, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert short range", 3, 13) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ c.reserve(100);
+ tracker_allocator_counter::reset();
+ c.insert(c.begin() + 7, 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/vector/cons/1.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/1.cc
new file mode 100644
index 000000000..f17de5c57
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/1.cc
@@ -0,0 +1,47 @@
+// 1999-06-29 bkoz
+
+// Copyright (C) 1999-2001, 2002, 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.4.1 vector constructors, copy, and assignment
+
+#include <vector>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+void test01()
+{
+ // 1
+ std::vector< A<B> > vec01;
+ std::vector< A<B> > vec02(5);
+ typedef std::vector< A<B> >::size_type size_type;
+
+ vec01 = vec02;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/2.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/2.cc
new file mode 100644
index 000000000..24add08ab
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/2.cc
@@ -0,0 +1,48 @@
+// 1999-06-29 bkoz
+
+// Copyright (C) 1999-2001, 2002, 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.4.1 vector constructors, copy, and assignment
+
+#include <vector>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+// 2
+template class std::vector<double>;
+template class std::vector< A<B> >;
+
+// libstdc++/102
+void test02()
+{
+ std::vector<int> v1;
+ std::vector<int> v2(v1);
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/3.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/3.cc
new file mode 100644
index 000000000..03859ece7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/3.cc
@@ -0,0 +1,53 @@
+// 1999-06-29 bkoz
+
+// Copyright (C) 1999-2001, 2002, 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.4.1 vector constructors, copy, and assignment
+
+#include <vector>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+// test range constructors and range-fill constructor
+void
+test03()
+{
+ 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[] = {7, 7, 7, 7, 7};
+ const int N = sizeof(A) / sizeof(int);
+ const int M = sizeof(B) / sizeof(int);
+
+ std::vector<int> v3(A, A + N);
+ VERIFY(std::equal(v3.begin(), v3.end(), A));
+
+ std::vector<int> v4(v3.begin(), v3.end());
+ VERIFY(std::equal(v4.begin(), v4.end(), A));
+
+ std::vector<int> v5(M, 7);
+ VERIFY(std::equal(v5.begin(), v5.end(), B));
+ VERIFY(std::equal(B, B + M, v5.begin()));
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/4.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/4.cc
new file mode 100644
index 000000000..27d496ac9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/4.cc
@@ -0,0 +1,584 @@
+// 1999-06-29 bkoz
+
+// Copyright (C) 1999-2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.4.1 vector constructors, copy, and assignment
+
+#include <vector>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+using __gnu_test::copy_tracker;
+using __gnu_test::tracker_allocator_counter;
+using __gnu_test::tracker_allocator;
+using __gnu_test::copy_constructor;
+using __gnu_test::assignment_operator;
+
+// @fn test_default_ctor_exception_gurantee This test verifies that if
+// one of the vector's contained objects throws an exception from its
+// constructor while the vector is being constructed and filled with
+// default values, all memory is returned to the allocator whence it
+// came.
+void
+test_default_ctor_exception_gurantee()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ copy_tracker::reset();
+ copy_constructor::throw_on(3);
+ tracker_allocator_counter::reset();
+
+ // run test
+ try
+ {
+ T ref;
+ X a(7, ref);
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ }
+
+ // assert postconditions
+ VERIFY( tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count() );
+
+ // teardown
+}
+
+// @fn test_copy_ctor_exception_gurantee This test verifies that if
+// one of the vector's contained objects throws an exception from its
+// constructor while the vector is being copy constructed, all memory
+// is returned to the allocator whence it came.
+void
+test_copy_ctor_exception_gurantee()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X a(7);
+ copy_tracker::reset();
+ copy_constructor::throw_on(3);
+
+ // run test
+ try
+ {
+ X u(a);
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ }
+ }
+
+ // assert postconditions
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+// operator=()
+//
+// case 1: lhs.size() > rhs.size()
+// case 2: lhs.size() < rhs.size() < lhs.capacity()
+// case 3: lhs.capacity() < rhs.size()
+//
+void
+test_assignment_operator_1()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ X r(9);
+ X a(r.size() - 2);
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+
+ // preconditions
+ VERIFY(r.size() > a.size());
+
+ // run test
+ r = a;
+
+ // assert postconditions
+ VERIFY(r == a);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == 0);
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_assignment_operator_2()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ X r(1);
+ r.reserve(17);
+ X a(r.size() + 7);
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+
+ // preconditions
+ VERIFY(r.size() < a.size());
+ VERIFY(a.size() < r.capacity());
+
+ // run test
+ r = a;
+
+ // assert postconditions
+ VERIFY(r == a);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == 0);
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_assignment_operator_3()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X r(1);
+ X a(r.capacity() + 7);
+ copy_tracker::reset();
+
+ // preconditions
+ VERIFY(r.capacity() < a.size());
+
+ // run test
+ r = a;
+
+ // assert postconditions
+ VERIFY(r == a);
+ }
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_assignment_operator_3_exception_guarantee()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X r(1);
+ X a(r.capacity() + 7);
+ copy_tracker::reset();
+ copy_constructor::throw_on(3);
+
+ // preconditions
+ VERIFY(r.capacity() < a.size());
+
+ // run test
+ try
+ {
+ r = a;
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ }
+ }
+
+ // assert postconditions
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+// fill assign()
+//
+// case 1: [23.2.4.1 (3)] n <= size()
+// case 2: [23.2.4.1 (3)] size() < n <= capacity()
+// case 3: [23.2.4.1 (3)] n > capacity()
+// case 4: [23.2.4.1 (3)] n > capacity(), exception guarantees
+// case 5: [23.1.1 (9)] fill assign disguised as a range assign
+//
+void
+test_fill_assign_1()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ X a(7);
+ X::size_type old_size = a.size();
+ X::size_type new_size = old_size - 2;
+ const T t;
+
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+
+ // run test
+ a.assign(new_size, t);
+
+ // assert postconditions
+ VERIFY(a.size() == new_size);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == 0);
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_fill_assign_2()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ X a(7);
+ a.reserve(11);
+ X::size_type old_size = a.size();
+ X::size_type old_capacity = a.capacity();
+ X::size_type new_size = old_size + 2;
+ const T t;
+
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+
+ // assert preconditions
+ VERIFY(old_size < new_size);
+ VERIFY(new_size <= old_capacity);
+
+ // run test
+ a.assign(new_size, t);
+
+ // assert postconditions
+ VERIFY(a.size() == new_size);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == 0);
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_fill_assign_3()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X a(7);
+ X::size_type old_capacity = a.capacity();
+ X::size_type new_size = old_capacity + 4;
+ const T t;
+
+ copy_tracker::reset();
+
+ // assert preconditions
+ VERIFY(new_size > old_capacity);
+
+ // run test
+ a.assign(new_size, t);
+
+ // assert postconditions
+ VERIFY(a.size() == new_size);
+ }
+
+ VERIFY(tracker_allocator_counter::get_allocation_count() > 0);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_fill_assign_3_exception_guarantee()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X a(7);
+ X::size_type old_size = a.size();
+ X::size_type old_capacity = a.capacity();
+ X::size_type new_size = old_capacity + 4;
+ const T t;
+
+ copy_tracker::reset();
+ copy_constructor::throw_on(3);
+
+ // assert preconditions
+ VERIFY(new_size > old_capacity);
+
+ // run test
+ try
+ {
+ a.assign(new_size, t);
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ }
+
+ // assert postconditions
+ VERIFY(a.size() == old_size);
+ VERIFY(a.capacity() == old_capacity);
+ }
+
+ VERIFY(tracker_allocator_counter::get_allocation_count() > 0);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_fill_assign_4()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ X a(7);
+ X::size_type old_size = a.size();
+ X::size_type new_size = old_size - 2;
+ X::size_type new_value = 117;
+
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+
+ // run test
+ a.assign(new_size, new_value);
+
+ // assert postconditions
+ VERIFY(a.size() == new_size);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == 0);
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+// range assign()
+//
+// case 1: [23.2.4.1 (2)] input iterator
+// case 2: [23.2.4.1 (2)] forward iterator, distance(first, last) <= size()
+// case 3: [23.2.4.1 (2)]
+// forward iterator, size() < distance(first, last) <= capacity()
+// case 4: [23.2.4.1 (2)] forward iterator, distance(first, last) > capacity()
+// case 5: [23.2.4.1 (2)]
+// forward iterator, distance(first, last) > capacity(),
+// exception guarantees
+void
+test_range_assign_1()
+{
+ // @TODO
+}
+
+void
+test_range_assign_2()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ X a(7);
+ X b(3);
+
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+
+ // assert preconditions
+ VERIFY(b.size() < a.capacity());
+
+ // run test
+ a.assign(b.begin(), b.end());
+
+ // assert postconditions
+ VERIFY(a.size() == b.size());
+ VERIFY(a == b);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == 0);
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_range_assign_3()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ X a(7);
+ a.reserve(a.size() + 7);
+ X b(a.size() + 3);
+
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+
+ // assert preconditions
+ VERIFY(a.size() < b.size());
+ VERIFY(b.size() < a.capacity());
+
+ // run test
+ a.assign(b.begin(), b.end());
+
+ // assert postconditions
+ VERIFY(a.size() == b.size());
+ VERIFY(a == b);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == 0);
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_range_assign_4()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X a(7);
+ X b(a.capacity() + 7);
+
+ copy_tracker::reset();
+
+ // assert preconditions
+ VERIFY(b.size() > a.capacity());
+
+ // run test
+ a.assign(b.begin(), b.end());
+
+ // assert postconditions
+ VERIFY(a.size() == b.size());
+ VERIFY(a == b);
+ }
+ VERIFY(tracker_allocator_counter::get_allocation_count() > 0);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+void
+test_range_assign_4_exception_guarantee()
+{
+ // setup
+ bool test __attribute__((unused)) = true;
+ typedef copy_tracker T;
+ typedef std::vector<T, tracker_allocator<T> > X;
+
+ tracker_allocator_counter::reset();
+ {
+ X a(7);
+ X b(a.capacity() + 7);
+
+ copy_tracker::reset();
+ copy_constructor::throw_on(3);
+
+ // assert preconditions
+ VERIFY(b.size() > a.capacity());
+
+ // run test
+ try
+ {
+ a.assign(b.begin(), b.end());
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ }
+ }
+
+ // assert postconditions
+ VERIFY(tracker_allocator_counter::get_allocation_count() > 0);
+ VERIFY(tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count());
+
+ // teardown
+ copy_tracker::reset();
+ tracker_allocator_counter::reset();
+}
+
+
+int main()
+{
+ test_default_ctor_exception_gurantee();
+ test_copy_ctor_exception_gurantee();
+ test_assignment_operator_1();
+ test_assignment_operator_2();
+ test_assignment_operator_3();
+ test_assignment_operator_3_exception_guarantee();
+ test_fill_assign_1();
+ test_fill_assign_2();
+ test_fill_assign_3();
+ test_fill_assign_3_exception_guarantee();
+ test_fill_assign_4();
+ test_range_assign_1();
+ test_range_assign_2();
+ test_range_assign_3();
+ test_range_assign_4();
+ test_range_assign_4_exception_guarantee();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/6513.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/6513.cc
new file mode 100644
index 000000000..b469fdcab
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/6513.cc
@@ -0,0 +1,39 @@
+// 1999-06-29 bkoz
+
+// Copyright (C) 1999-2001, 2002, 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.4.1 vector constructors, copy, and assignment
+
+#include <vector>
+#include <string>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+
+// libstdc++/6513
+void test04()
+{
+ const char* c_strings[5] = { "1", "2", "3", "4", "5" };
+ std::vector<std::string> strings(c_strings, c_strings + 5);
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/clear_allocator.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/clear_allocator.cc
new file mode 100644
index 000000000..18a2f1a02
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/clear_allocator.cc
@@ -0,0 +1,87 @@
+// 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 <vector>
+#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;
+ }
+
+
+int main()
+{
+ Check_Container<std::vector<int, clear_alloc<int> > >();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc
new file mode 100644
index 000000000..a33ba1ad6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<__gnu_test::NonCopyConstructible> v(1000);
+ VERIFY( std::distance(v.begin(), v.end()) == 1000 );
+ for(auto it = v.begin(); it != v.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc
new file mode 100644
index 000000000..8807ad9b4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on vector (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <vector>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<int> a,b;
+ a.push_back(1);
+ b = std::move(a);
+ VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 );
+
+ std::vector<int> c(std::move(b));
+ VERIFY( c.size() == 1 && c[0] == 1 );
+ VERIFY( b.size() == 0 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<bool> a,b;
+ a.push_back(1);
+ b = std::move(a);
+ VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 );
+
+ std::vector<bool> c(std::move(b));
+ VERIFY( c.size() == 1 && c[0] == 1 );
+ VERIFY( b.size() == 0 );
+}
+
+int main(void)
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/moveable2.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable2.cc
new file mode 100644
index 000000000..ab04ccf0c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable2.cc
@@ -0,0 +1,55 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <vector>
+#include <iterator>
+#include <testsuite_iterators.h>
+#include <testsuite_rvalref.h>
+
+using namespace __gnu_test;
+typedef std::vector<rvalstruct> test_type;
+
+// Empty constructor doesn't require a copy constructor
+void
+test01()
+{ test_type d; }
+
+// Constructing from a range that returns rvalue references doesn't
+// require a copy constructor.
+void
+test02(rvalstruct* begin, rvalstruct* end)
+{
+ test_type d(std::make_move_iterator(begin), std::make_move_iterator(end));
+}
+
+// Constructing from a input iterator range that returns rvalue
+// references doesn't require a copy constructor either.
+void
+test03(input_iterator_wrapper<rvalstruct> begin,
+ input_iterator_wrapper<rvalstruct> end)
+{
+ test_type d(std::make_move_iterator(begin), std::make_move_iterator(end));
+}
+
+// Neither does destroying one.
+void
+test04(test_type* d)
+{ delete d; }
diff --git a/libstdc++-v3/testsuite/23_containers/vector/data_access/1.cc b/libstdc++-v3/testsuite/23_containers/vector/data_access/1.cc
new file mode 100644
index 000000000..ae829984a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/data_access/1.cc
@@ -0,0 +1,50 @@
+// 2005-08-29 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 <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/23578
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::vector<int> vector_type;
+
+ {
+ const int A[] = { 0, 1, 2, 3, 4 };
+ vector_type v(A, A + 5);
+ VERIFY( v.data() == &v.front() );
+ int* pi = v.data();
+ VERIFY( *pi == 0 );
+ }
+
+ {
+ const int A[] = { 4, 3, 2, 1, 0 };
+ const vector_type cv(A, A + 5);
+ VERIFY( cv.data() == &cv.front() );
+ const int* pci = cv.data();
+ VERIFY( *pci == 4 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/52433.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/52433.cc
new file mode 100644
index 000000000..f1f5917d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/52433.cc
@@ -0,0 +1,43 @@
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// PR libstdc++/52433
+
+#include <vector>
+
+struct X
+{
+ std::vector<int>::iterator i;
+
+ X() = default;
+ X(const X&) = default;
+ X(X&&) = default;
+ X& operator=(const X&) = default;
+ X& operator=(X&&) = default;
+};
+
+X test01()
+{
+ X x;
+ x = X();
+ return x;
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign1_neg.cc
new file mode 100644
index 000000000..ff9c5a24b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_assign1<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign2_neg.cc
new file mode 100644
index 000000000..4384a97bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_assign2<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign3_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign3_neg.cc
new file mode 100644
index 000000000..9cb7ea6f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_assign3<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc
new file mode 100644
index 000000000..8e3d3be9c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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/vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_assign1<__gnu_debug::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/construct1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/construct1_neg.cc
new file mode 100644
index 000000000..dc0b4a22e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct1<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/construct2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/construct2_neg.cc
new file mode 100644
index 000000000..13757a1fa
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct2<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/construct3_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/construct3_neg.cc
new file mode 100644
index 000000000..661af4382
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct3<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/construct4_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/construct4_neg.cc
new file mode 100644
index 000000000..ec33a5813
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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/vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_construct1<__gnu_debug::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/insert1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/insert1_neg.cc
new file mode 100644
index 000000000..2ec0d9e02
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert1<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/insert2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/insert2_neg.cc
new file mode 100644
index 000000000..011ad4c0c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert2<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/insert3_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/insert3_neg.cc
new file mode 100644
index 000000000..4dab133b5
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert3<std::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/insert4_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/insert4_neg.cc
new file mode 100644
index 000000000..684ebb598
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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/vector>
+#include <debug/checks.h>
+
+void test01()
+{
+ __gnu_test::check_insert1<__gnu_debug::vector<int> >();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/1.cc
new file mode 100644
index 000000000..0111efe48
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/1.cc
@@ -0,0 +1,59 @@
+// Vector 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/>.
+
+// We need to be pedantic about reallocations for this testcase to be correct.
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+
+#ifndef _GLIBCXX_DEBUG_PEDANTIC
+# define _GLIBCXX_DEBUG_PEDANTIC 1
+#endif
+
+#include <debug/vector>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::vector;
+
+bool test = true;
+
+// Assignment
+void test01()
+{
+ vector<int> v1;
+ vector<int> v2;
+
+ vector<int>::iterator i = v1.end();
+ VERIFY(!i._M_dereferenceable() && !i._M_singular());
+
+ v1 = v2;
+ VERIFY(i._M_singular());
+
+ i = v1.end();
+ v1.assign(v2.begin(), v2.end());
+ VERIFY(i._M_singular());
+
+ i = v1.end();
+ v1.assign(17, 42);
+ VERIFY(i._M_singular());
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/2.cc
new file mode 100644
index 000000000..9652ffb53
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/2.cc
@@ -0,0 +1,64 @@
+// Vector 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/>.
+
+// We need to be pedantic about reallocations for this testcase to be correct.
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+
+#ifndef _GLIBCXX_DEBUG_PEDANTIC
+# define _GLIBCXX_DEBUG_PEDANTIC 1
+#endif
+
+#include <debug/vector>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::vector;
+
+bool test = true;
+
+// Resize
+void test02()
+{
+ vector<int> v(10, 17);
+ v.reserve(20);
+
+ vector<int>::iterator before = v.begin() + 6;
+ vector<int>::iterator at = before + 1;
+ vector<int>::iterator after = at + 1;
+
+ // Shrink
+ v.resize(7);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+ VERIFY(after._M_singular());
+
+ // Grow, without reallocation
+ before = v.begin() + 6;
+ v.resize(17);
+ VERIFY(before._M_dereferenceable());
+
+ // Grow, with reallocation
+ v.resize(42);
+ VERIFY(before._M_singular());
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/3.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/3.cc
new file mode 100644
index 000000000..df8759c52
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/3.cc
@@ -0,0 +1,89 @@
+// Vector 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/>.
+
+// We need to be pedantic about reallocations for this testcase to be correct.
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+
+#ifndef _GLIBCXX_DEBUG_PEDANTIC
+# define _GLIBCXX_DEBUG_PEDANTIC 1
+#endif
+
+#include <debug/vector>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::vector;
+
+bool test = true;
+
+// Insert
+void test03()
+{
+ vector<int> v(10, 17);
+ v.reserve(30);
+
+ // Insert a single element
+ vector<int>::iterator before = v.begin() + 6;
+ vector<int>::iterator at = before + 1;
+ vector<int>::iterator after = at;
+ at = v.insert(at, 42);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_dereferenceable());
+ VERIFY(after._M_singular());
+
+ // Insert multiple copies
+ before = v.begin() + 6;
+ at = before + 1;
+ v.insert(at, 3, 42);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+
+ // Insert iterator range
+ static int data[] = { 2, 3, 5, 7 };
+ before = v.begin() + 6;
+ at = before + 1;
+ v.insert(at, &data[0], &data[0] + 4);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+
+ // Insert with reallocation
+ before = v.begin() + 6;
+ at = before + 1;
+ v.insert(at, 30, 17);
+ VERIFY(before._M_singular());
+ VERIFY(at._M_singular());
+
+ // Single insert with reallocation
+ vector<int> v2;
+ v2.reserve(100);
+ at = v2.begin();
+ v2.insert(at, 100, 17);
+ at = v2.end() - 1;
+ before = v2.begin();
+ VERIFY(at._M_dereferenceable());
+ VERIFY(before._M_dereferenceable());
+ at = v2.insert(at, 42);
+ VERIFY(at._M_dereferenceable());
+ VERIFY(before._M_singular());
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/4.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/4.cc
new file mode 100644
index 000000000..569530693
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/invalidation/4.cc
@@ -0,0 +1,66 @@
+// Vector 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/>.
+
+// We need to be pedantic about reallocations for this testcase to be correct.
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+
+#ifndef _GLIBCXX_DEBUG_PEDANTIC
+# define _GLIBCXX_DEBUG_PEDANTIC 1
+#endif
+
+#include <debug/vector>
+#include <testsuite_hooks.h>
+
+using __gnu_debug::vector;
+
+bool test = true;
+
+// Erase
+void test04()
+{
+ vector<int> v(20, 42);
+
+ // Single element erase
+ vector<int>::iterator before = v.begin();
+ vector<int>::iterator at = before + 3;
+ vector<int>::iterator after = at;
+ at = v.erase(at);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_dereferenceable());
+ VERIFY(after._M_singular());
+
+ // Multiple element erase
+ before = v.begin();
+ at = before + 3;
+ v.erase(at, at + 3);
+ VERIFY(before._M_dereferenceable());
+ VERIFY(at._M_singular());
+
+ // clear()
+ before = v.begin();
+ VERIFY(before._M_dereferenceable());
+ v.clear();
+ VERIFY(before._M_singular());
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/multithreaded_swap.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/multithreaded_swap.cc
new file mode 100644
index 000000000..b2a50aa21
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/multithreaded_swap.cc
@@ -0,0 +1,100 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-debug-mode "" }
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+// This test check for potential deadlock when swaping sequences in debug
+// mode as it requires acquiring 2 locks at the same time.
+
+#include <vector>
+#include <thread>
+#include <functional>
+#include <testsuite_hooks.h>
+
+// The following function mimic the one in src/debug.cc to associate a mutex
+// to a given safe sequence instance.
+size_t
+get_index(std::vector<int>& v)
+{
+ const size_t mask = 0xf;
+ // We have to check the address of the internal safe sequence that starts
+ // after the normal vector memory footprint that is to say a 3 pointers
+ // offset:
+ void* __address = reinterpret_cast<char*>(&v) + 3 * sizeof(void*);
+ return std::_Hash_impl::hash(__address) & mask;
+}
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+ vector<int> v1, v2;
+ vector<shared_ptr<vector<int> > > vs;
+ vector<int> *pv3 = 0, *pv4 = 0;
+ const int nb_attempts = 100;
+ for (int i = 0; i != nb_attempts; ++i)
+ {
+ vs.push_back(shared_ptr<vector<int> >(new vector<int>()));
+ if (!pv3)
+ {
+ if (get_index(*vs.back()) == get_index(v1))
+ pv3 = vs.back().get();
+ }
+ else if (!pv4)
+ {
+ if (get_index(*vs.back()) == get_index(v2))
+ {
+ pv4 = vs.back().get();
+ break;
+ }
+ }
+ }
+
+ if (!pv3 || !pv4)
+ // Maybe an other time...
+ return;
+
+ vector<int> &v3 = *pv3, &v4 = *pv4;
+
+ // v1 and v3 shares the same mutex instance, like v2 and v4
+ // thread t1 lock v1 and v2
+ thread t1([&v1, &v2]()
+ {
+ for (int i = 0; i != 1000; ++i)
+ v1.swap(v2);
+ });
+ // thread t2 lock v4 and v3
+ thread t2([&v3, &v4]()
+ {
+ for (int i = 0; i != 1000; ++i)
+ v4.swap(v3);
+ });
+ t2.join();
+ t1.join();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug_mode_requires_reallocation-1.cc b/libstdc++-v3/testsuite/23_containers/vector/debug_mode_requires_reallocation-1.cc
new file mode 100644
index 000000000..3f65119a7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug_mode_requires_reallocation-1.cc
@@ -0,0 +1,50 @@
+// 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/>.
+
+// NB: This issue affected only debug-mode.
+
+#include <vector>
+#include <algorithm>
+#include <iterator>
+
+// http://gcc.gnu.org/ml/libstdc++/2008-05/msg00039.html
+void test01()
+{
+ typedef std::vector<unsigned> array_t;
+ typedef std::back_insert_iterator<array_t> bii_t;
+
+ array_t a;
+
+ // Push 5 elements.
+ a.push_back(0);
+ a.push_back(1);
+ a.push_back(2);
+ a.push_back(3);
+ a.push_back(4);
+ // Ensure that there is enough space for other two elements.
+ // (2 + 5 = 7)
+ if (a.capacity() < 7)
+ a.reserve(7);
+ // Add two new elements.
+ std::copy(a.begin(), a.begin() + 2, bii_t(a));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug_mode_requires_reallocation-2.cc b/libstdc++-v3/testsuite/23_containers/vector/debug_mode_requires_reallocation-2.cc
new file mode 100644
index 000000000..56bc10909
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug_mode_requires_reallocation-2.cc
@@ -0,0 +1,52 @@
+// 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/>.
+
+// NB: This issue affected only debug-mode, in pedantic mode.
+
+// { dg-options "-D_GLIBCXX_DEBUG_PEDANTIC" }
+
+#include <vector>
+#include <algorithm>
+#include <iterator>
+
+// http://gcc.gnu.org/ml/libstdc++/2008-05/msg00046.html
+void test01()
+{
+ typedef std::vector<unsigned> array_t;
+ typedef std::back_insert_iterator<array_t> bii_t;
+
+ array_t a;
+
+ // Push 5 elements.
+ a.push_back(0);
+ a.push_back(1);
+ a.push_back(2);
+ a.push_back(3);
+ a.push_back(4);
+ // Ensure that there is enough space for other two elements.
+ // (2 + 5 = 7)
+ if (a.capacity() < 7)
+ a.reserve(7);
+ // Add two new elements.
+ std::copy(a.begin(), a.begin() + 2, bii_t(a));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/element_access/1.cc b/libstdc++-v3/testsuite/23_containers/vector/element_access/1.cc
new file mode 100644
index 000000000..511620cac
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/element_access/1.cc
@@ -0,0 +1,61 @@
+// 2000-09-06
+// bkoz
+
+// Copyright (C) 2000, 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.4 vector
+
+#include <vector>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+template<typename T>
+struct A { };
+
+struct B { };
+
+// http://gcc.gnu.org/ml/libstdc++/2000-09/msg00002.html
+bool test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::vector< A<B> > vec01;
+ std::vector< A<B> > vec02(5);
+ typedef std::vector< A<B> >::size_type size_type;
+ typedef std::vector< A<B> >::reference reference;
+
+ try
+ {
+ reference r01 __attribute__((unused)) = vec01.at(6);
+ VERIFY( false ); // Should not get here, as exception thrown.
+ }
+ catch(std::out_of_range& err)
+ {
+ VERIFY( true );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/citerators.cc
new file mode 100644
index 000000000..4037536ec
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/citerators.cc
@@ -0,0 +1,46 @@
+// { 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 <vector>
+#include <testsuite_hooks.h>
+#include <ext/extptr_allocator.h>
+
+// Ensures equivalence of iterators based on low-level comparison
+// between const / non-const Pointer types.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<int, __gnu_cxx::_ExtPtr_allocator<int> > v(7);
+ VERIFY( v.cbegin() == v.begin() );
+ VERIFY( v.cend() == v.end() );
+ VERIFY( v.crbegin() == v.rbegin() );
+ VERIFY( v.crend() == v.rend() );
+ VERIFY( v.cbegin() != v.cend() );
+ VERIFY( v.crbegin() != v.crend() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/data_access.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/data_access.cc
new file mode 100644
index 000000000..a74f44c40
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/data_access.cc
@@ -0,0 +1,53 @@
+// Test for Container using non-standard pointer types.
+
+// 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 <vector>
+#include <testsuite_hooks.h>
+#include <ext/extptr_allocator.h>
+
+// libstdc++/23578
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::vector<int, __gnu_cxx::_ExtPtr_allocator<int> > vector_type;
+
+ {
+ const int A[] = { 0, 1, 2, 3, 4 };
+ vector_type v(A, A + 5);
+ VERIFY( v.data() == &v.front() );
+ int* pi = &* v.data();
+ VERIFY( *pi == 0 );
+ }
+
+ {
+ const int A[] = { 4, 3, 2, 1, 0 };
+ const vector_type cv(A, A + 5);
+ VERIFY( cv.data() == &cv.front() );
+ const int* pci = &* cv.data();
+ VERIFY( *pci == 4 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/1.cc
new file mode 100644
index 000000000..5f585e449
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/1.cc
@@ -0,0 +1,27 @@
+// Test for Container using non-standard pointer types.
+
+// 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 <vector>
+#include <ext/extptr_allocator.h>
+
+// { dg-do compile }
+
+template class std::vector<int, __gnu_cxx::_ExtPtr_allocator<int> >;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/3.cc
new file mode 100644
index 000000000..8c6d3dc55
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/3.cc
@@ -0,0 +1,28 @@
+// Test for Container using non-standard pointer types.
+
+// 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 <vector>
+#include <ext/extptr_allocator.h>
+
+// { dg-do compile }
+
+// libstdc++/21770
+template class std::vector<int, __gnu_cxx::_ExtPtr_allocator<char> >;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/element.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/element.cc
new file mode 100644
index 000000000..c12b81cc2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/element.cc
@@ -0,0 +1,77 @@
+// Test for Container using non-standard pointer types.
+
+// 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 <vector>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+#include <ext/extptr_allocator.h>
+
+// General tests element access and manipulation
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ int A[] = { 0, 1, 2, 3, 4 };
+ __gnu_cxx::_ExtPtr_allocator<int> alloc;
+ std::vector<int,__gnu_cxx::_ExtPtr_allocator<int> > mv( A, A+5, alloc );
+
+ VERIFY( mv.size() == 5 );
+ VERIFY( mv.front() == 0 );
+ VERIFY( mv.back() == 4 );
+ VERIFY( mv.at(2) == 2 );
+ VERIFY( mv[3] == 3);
+ mv.front() = 5;
+ mv.back() = 6;
+ mv.at(2) = 7;
+ mv[3] = 8;
+ VERIFY( mv.size() == 5 );
+ VERIFY( mv.front() == 5 );
+ VERIFY( mv.back() == 6 );
+ VERIFY( mv.at(2) == 7 );
+ VERIFY( mv[3] == 8 );
+
+ try
+ {
+ mv.at(100) = 8;
+ }
+ catch(std::out_of_range&)
+ {
+ VERIFY( true );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+
+ const std::vector<int,__gnu_cxx::_ExtPtr_allocator<int> > cmv( mv );
+ VERIFY( cmv.get_allocator() == mv.get_allocator() );
+ VERIFY( mv.size() == 5 );
+ VERIFY( mv.front() == 5 );
+ VERIFY( mv.back() == 6 );
+ VERIFY( mv.at(2) == 7 );
+ VERIFY( mv[3] == 8 );
+}
+
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/erase.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/erase.cc
new file mode 100644
index 000000000..99008ce54
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/erase.cc
@@ -0,0 +1,139 @@
+// Bob Walters 10-2008
+
+// Test for Container using non-standard pointer types.
+
+// 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 <vector>
+#include <testsuite_hooks.h>
+#include <ext/extptr_allocator.h>
+
+const int A[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+const int A1[] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+const int A2[] = {0, 2, 3, 4, 10, 11, 12, 13, 14, 15};
+const int A3[] = {0, 2, 3, 4, 10, 11};
+const int A4[] = {4, 10, 11};
+const int A5[] = {4, 10};
+const unsigned int N = sizeof(A) / sizeof(int);
+const unsigned int N1 = sizeof(A1) / sizeof(int);
+const unsigned int N2 = sizeof(A2) / sizeof(int);
+const unsigned int N3 = sizeof(A3) / sizeof(int);
+const unsigned int N4 = sizeof(A4) / sizeof(int);
+const unsigned int N5 = sizeof(A5) / sizeof(int);
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<int,__gnu_cxx::_ExtPtr_allocator<int> > vec_type;
+ typedef vec_type::iterator iterator_type;
+
+ vec_type v(A, A + N);
+
+ iterator_type it1 = v.erase(v.begin() + 1);
+ VERIFY( it1 == v.begin() + 1 );
+ VERIFY( v.size() == N1 );
+ VERIFY( std::equal(v.begin(), v.end(), A1) );
+
+ iterator_type it2 = v.erase(v.begin() + 4, v.begin() + 9);
+ VERIFY( it2 == v.begin() + 4 );
+ VERIFY( v.size() == N2 );
+ VERIFY( std::equal(v.begin(), v.end(), A2) );
+
+ iterator_type it3 = v.erase(v.begin() + 6, v.end());
+ VERIFY( it3 == v.begin() + 6 );
+ VERIFY( v.size() == N3 );
+ VERIFY( std::equal(v.begin(), v.end(), A3) );
+
+ iterator_type it4 = v.erase(v.begin(), v.begin() + 3);
+ VERIFY( it4 == v.begin() );
+ VERIFY( v.size() == N4 );
+ VERIFY( std::equal(v.begin(), v.end(), A4) );
+
+ iterator_type it5 = v.erase(v.begin() + 2);
+ VERIFY( it5 == v.begin() + 2 );
+ VERIFY( v.size() == N5 );
+ VERIFY( std::equal(v.begin(), v.end(), A5) );
+
+ iterator_type it6 = v.erase(v.begin(), v.end());
+ VERIFY( it6 == v.begin() );
+ VERIFY( v.empty() );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef __gnu_cxx::_ExtPtr_allocator<int> int_alloc_type;
+ typedef __gnu_cxx::_ExtPtr_allocator< std::vector<int, int_alloc_type> > vec_alloc_type;
+ typedef std::vector<std::vector<int, int_alloc_type >,vec_alloc_type> vec_type;
+ typedef vec_type::iterator iterator_type;
+
+ vec_type v, v1, v2, v3, v4, v5;
+ for (unsigned int i = 0; i < N; ++i)
+ v.push_back(std::vector<int,int_alloc_type>(1, A[i]));
+ for (unsigned int i = 0; i < N1; ++i)
+ v1.push_back(std::vector<int,int_alloc_type>(1, A1[i]));
+ for (unsigned int i = 0; i < N2; ++i)
+ v2.push_back(std::vector<int,int_alloc_type>(1, A2[i]));
+ for (unsigned int i = 0; i < N3; ++i)
+ v3.push_back(std::vector<int,int_alloc_type>(1, A3[i]));
+ for (unsigned int i = 0; i < N4; ++i)
+ v4.push_back(std::vector<int,int_alloc_type>(1, A4[i]));
+ for (unsigned int i = 0; i < N5; ++i)
+ v5.push_back(std::vector<int,int_alloc_type>(1, A5[i]));
+
+ iterator_type it1 = v.erase(v.begin() + 1);
+ VERIFY( it1 == v.begin() + 1 );
+ VERIFY( v.size() == N1 );
+ VERIFY( std::equal(v.begin(), v.end(), v1.begin()) );
+
+ iterator_type it2 = v.erase(v.begin() + 4, v.begin() + 9);
+ VERIFY( it2 == v.begin() + 4 );
+ VERIFY( v.size() == N2 );
+ VERIFY( std::equal(v.begin(), v.end(), v2.begin()) );
+
+ iterator_type it3 = v.erase(v.begin() + 6, v.end());
+ VERIFY( it3 == v.begin() + 6 );
+ VERIFY( v.size() == N3 );
+ VERIFY( std::equal(v.begin(), v.end(), v3.begin()) );
+
+ iterator_type it4 = v.erase(v.begin(), v.begin() + 3);
+ VERIFY( it4 == v.begin() );
+ VERIFY( v.size() == N4 );
+ VERIFY( std::equal(v.begin(), v.end(), v4.begin()) );
+
+ iterator_type it5 = v.erase(v.begin() + 2);
+ VERIFY( it5 == v.begin() + 2 );
+ VERIFY( v.size() == N5 );
+ VERIFY( std::equal(v.begin(), v.end(), v5.begin()) );
+
+ iterator_type it6 = v.erase(v.begin(), v.end());
+ VERIFY( it6 == v.begin() );
+ VERIFY( v.empty() );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/insert.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/insert.cc
new file mode 100644
index 000000000..6405287d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/modifiers/insert.cc
@@ -0,0 +1,67 @@
+// Test for Container using non-standard pointer types.
+
+// 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 <vector>
+#include <testsuite_hooks.h>
+#include <ext/extptr_allocator.h>
+#include <stdexcept>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::_ExtPtr_allocator<int> alloc;
+ std::vector<int, __gnu_cxx::_ExtPtr_allocator<int> > iv(alloc);
+ VERIFY( iv.get_allocator() == alloc );
+ VERIFY( iv.size() == 0 );
+
+ int A[] = { 0, 1, 2, 3, 4 };
+ int B[] = { 5, 5, 5, 5, 5 };
+ int C[] = { 6, 7 };
+ iv.insert(iv.end(), A, A+5 );
+ VERIFY( iv.size() == 5 );
+ iv.insert(iv.begin(), 5, 5 );
+ iv.insert(iv.begin()+5, 7);
+ iv.insert(iv.begin()+5, 6);
+ VERIFY( std::equal(iv.begin(), iv.begin()+5, B ));
+ VERIFY( std::equal(iv.begin()+5, iv.begin()+7, C));
+ VERIFY( std::equal(iv.begin()+7, iv.end(), A));
+ VERIFY( iv.size() == 12 );
+
+ try
+ {
+ iv.insert(iv.end(), iv.max_size() + 1, 1);
+ }
+ catch(std::length_error&)
+ {
+ VERIFY( true );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/resize.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/resize.cc
new file mode 100644
index 000000000..432aca27c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/resize.cc
@@ -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 <vector>
+#include <stdexcept>
+#include <testsuite_allocator.h>
+#include <testsuite_hooks.h>
+#include <ext/extptr_allocator.h>
+
+
+void test01()
+{
+ // non POD types
+ bool test __attribute__((unused)) = true;
+
+ std::vector<int, __gnu_cxx::_ExtPtr_allocator<int> > vec01;
+ typedef std::vector<int, __gnu_cxx::_ExtPtr_allocator<int> >::size_type size_type;
+
+ VERIFY(vec01.empty());
+
+ const int A[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+
+ // Test resize of the vector based on reserve
+ size_type sz01 = vec01.capacity();
+ vec01.reserve(100);
+ size_type sz02 = vec01.capacity();
+ VERIFY(sz02 >= sz01);
+
+ // grow/shrink
+ vec01.assign( A, A+10 );
+ sz01 = vec01.size() + 100;
+ vec01.resize(sz01);
+ sz02 = vec01.size();
+ VERIFY(sz01 == sz02);
+ VERIFY(std::equal(vec01.begin(), vec01.begin()+10, A));
+
+ sz01 = vec01.size() - 100;
+ vec01.resize(sz01);
+ sz02 = vec01.size();
+ VERIFY(sz01 == sz02);
+ VERIFY(std::equal(vec01.begin(), vec01.end(), A));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/1.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/1.cc
new file mode 100644
index 000000000..66fd2c8bb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/1.cc
@@ -0,0 +1,61 @@
+// Test for Container using non-standard pointer types.
+
+// 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/>.
+
+
+// This is a copy of vector/types/1.cc with altered allocator.
+// The operator+()s in this test initially failed the test -
+// they stress the accurate recognition, by the compiler,
+// of _Pointer_adapter's own pointer arithmetic functions,
+// which have to match perfectly on the int type to get
+// chosen by the compiler when it sees: _Pointer_adapter<T> + int, etc.
+
+#include <vector>
+#include <ext/extptr_allocator.h>
+
+namespace N
+{
+ struct X { };
+
+ template<typename T>
+ X operator+(T, std::size_t)
+ { return X(); }
+
+ template<typename T>
+ X operator-(T, T)
+ { return X(); }
+}
+
+int main()
+{
+ std::vector<N::X, __gnu_cxx::_ExtPtr_allocator<N::X> > v(5);
+ const std::vector<N::X, __gnu_cxx::_ExtPtr_allocator<N::X> > w(1);
+
+ v[0];
+ w[0];
+ v.size();
+ v.capacity();
+ v.resize(1);
+ v.insert(v.begin(), N::X());
+ v.insert(v.begin(), 1, N::X());
+ v.insert(v.begin(), w.begin(), w.end());
+ v = w;
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/init-list.cc b/libstdc++-v3/testsuite/23_containers/vector/init-list.cc
new file mode 100644
index 000000000..87c485381
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/init-list.cc
@@ -0,0 +1,60 @@
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+// { dg-options "-std=gnu++0x" }
+
+#include <vector>
+#include <testsuite_allocator.h>
+
+using namespace __gnu_test;
+
+int main()
+{
+ typedef std::vector<int, tracker_allocator<int> > Container;
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ Container c({ 2, 4, 1 });
+ ok = check_construct_destroy("Construct from init-list", 3, 0) && ok;
+ ok &= (c[0] == 2);
+ ok &= (c[1] == 4);
+ }
+ ok = check_construct_destroy("Construct from init-list", 3, 3) && ok;
+
+ {
+ Container c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ c.insert(c.begin() + 7, { 234, 42, 1 });
+ ok = check_construct_destroy("Insert init-list", 13, 10) && ok;
+ ok &= (c[7] == 234);
+ }
+ ok = check_construct_destroy("Insert init-list", 13, 23) && ok;
+
+ {
+ Container c;
+ tracker_allocator_counter::reset();
+ c = { 13, 0, 42 };
+ ok = check_construct_destroy("Assign init-list", 3, 0) && ok;
+ ok &= (c[0] == 13);
+ }
+ ok = check_construct_destroy("Assign init-list", 3, 3) && ok;
+
+ return ok ? 0 : 1;;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/1.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/1.cc
new file mode 100644
index 000000000..af0bedcee
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/1.cc
@@ -0,0 +1,55 @@
+// 1999-11-09 bkoz
+
+// Copyright (C) 1999, 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.4.3 vector modifiers
+
+#include <vector>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+template<typename T>
+ struct A { };
+
+struct B { };
+
+// vector::insert(iterator, inputiterator first, inputiterator last)
+void
+test01()
+{
+ // POD types
+ typedef std::vector<int> vec_POD;
+ vec_POD vec01;
+ int i01 = 5;
+ int* pi01 = &i01;
+ vec01.insert(vec01.begin(), pi01, pi01 + 1);
+
+ // non POD types
+ typedef std::vector< A<B> > vec_nonPOD;
+ vec_nonPOD vec02;
+ A<B> np01;
+ A<B>* pnp01 = &np01;
+ vec02.insert(vec02.begin(), pnp01, pnp01 + 1);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/2.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/2.cc
new file mode 100644
index 000000000..7e152891b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/2.cc
@@ -0,0 +1,61 @@
+// 1999-11-09 bkoz
+
+// Copyright (C) 1999, 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.4.3 vector modifiers
+
+#include <vector>
+#include "testsuite_hooks.h"
+
+bool test __attribute__((unused)) = true;
+
+// test the assign() function
+void
+test03()
+{
+ const int K = 417;
+ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+ 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);
+ bool test __attribute__((unused)) = true;
+
+ // assign from pointer range
+ std::vector<int> v3;
+ v3.assign(A, A + N);
+ VERIFY(std::equal(v3.begin(), v3.end(), A));
+ VERIFY(v3.size() == N);
+
+ // assign from iterator range
+ std::vector<int> v4;
+ v4.assign(v3.begin(), v3.end());
+ VERIFY(std::equal(v4.begin(), v4.end(), A));
+ VERIFY(std::equal(A, A + N, v4.begin()));
+
+ // assign from initializer range with resize
+ v4.assign(M, K);
+ VERIFY(std::equal(v4.begin(), v4.end(), B));
+ VERIFY(std::equal(B, B + M, v4.begin()));
+ VERIFY((v4.size() == M) && (M != N));
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/1.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/1.cc
new file mode 100644
index 000000000..2f695e432
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/1.cc
@@ -0,0 +1,135 @@
+// 2005-11-02 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.4.3 vector modifiers
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+const int A[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+const int A1[] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+const int A2[] = {0, 2, 3, 4, 10, 11, 12, 13, 14, 15};
+const int A3[] = {0, 2, 3, 4, 10, 11};
+const int A4[] = {4, 10, 11};
+const int A5[] = {4, 10};
+const unsigned int N = sizeof(A) / sizeof(int);
+const unsigned int N1 = sizeof(A1) / sizeof(int);
+const unsigned int N2 = sizeof(A2) / sizeof(int);
+const unsigned int N3 = sizeof(A3) / sizeof(int);
+const unsigned int N4 = sizeof(A4) / sizeof(int);
+const unsigned int N5 = sizeof(A5) / sizeof(int);
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<int> vec_type;
+ typedef vec_type::iterator iterator_type;
+
+ vec_type v(A, A + N);
+
+ iterator_type it1 = v.erase(v.begin() + 1);
+ VERIFY( it1 == v.begin() + 1 );
+ VERIFY( v.size() == N1 );
+ VERIFY( std::equal(v.begin(), v.end(), A1) );
+
+ iterator_type it2 = v.erase(v.begin() + 4, v.begin() + 9);
+ VERIFY( it2 == v.begin() + 4 );
+ VERIFY( v.size() == N2 );
+ VERIFY( std::equal(v.begin(), v.end(), A2) );
+
+ iterator_type it3 = v.erase(v.begin() + 6, v.end());
+ VERIFY( it3 == v.begin() + 6 );
+ VERIFY( v.size() == N3 );
+ VERIFY( std::equal(v.begin(), v.end(), A3) );
+
+ iterator_type it4 = v.erase(v.begin(), v.begin() + 3);
+ VERIFY( it4 == v.begin() );
+ VERIFY( v.size() == N4 );
+ VERIFY( std::equal(v.begin(), v.end(), A4) );
+
+ iterator_type it5 = v.erase(v.begin() + 2);
+ VERIFY( it5 == v.begin() + 2 );
+ VERIFY( v.size() == N5 );
+ VERIFY( std::equal(v.begin(), v.end(), A5) );
+
+ iterator_type it6 = v.erase(v.begin(), v.end());
+ VERIFY( it6 == v.begin() );
+ VERIFY( v.empty() );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<std::vector<int> > vec_type;
+ typedef vec_type::iterator iterator_type;
+
+ vec_type v, v1, v2, v3, v4, v5;
+ for (unsigned int i = 0; i < N; ++i)
+ v.push_back(std::vector<int>(1, A[i]));
+ for (unsigned int i = 0; i < N1; ++i)
+ v1.push_back(std::vector<int>(1, A1[i]));
+ for (unsigned int i = 0; i < N2; ++i)
+ v2.push_back(std::vector<int>(1, A2[i]));
+ for (unsigned int i = 0; i < N3; ++i)
+ v3.push_back(std::vector<int>(1, A3[i]));
+ for (unsigned int i = 0; i < N4; ++i)
+ v4.push_back(std::vector<int>(1, A4[i]));
+ for (unsigned int i = 0; i < N5; ++i)
+ v5.push_back(std::vector<int>(1, A5[i]));
+
+ iterator_type it1 = v.erase(v.begin() + 1);
+ VERIFY( it1 == v.begin() + 1 );
+ VERIFY( v.size() == N1 );
+ VERIFY( std::equal(v.begin(), v.end(), v1.begin()) );
+
+ iterator_type it2 = v.erase(v.begin() + 4, v.begin() + 9);
+ VERIFY( it2 == v.begin() + 4 );
+ VERIFY( v.size() == N2 );
+ VERIFY( std::equal(v.begin(), v.end(), v2.begin()) );
+
+ iterator_type it3 = v.erase(v.begin() + 6, v.end());
+ VERIFY( it3 == v.begin() + 6 );
+ VERIFY( v.size() == N3 );
+ VERIFY( std::equal(v.begin(), v.end(), v3.begin()) );
+
+ iterator_type it4 = v.erase(v.begin(), v.begin() + 3);
+ VERIFY( it4 == v.begin() );
+ VERIFY( v.size() == N4 );
+ VERIFY( std::equal(v.begin(), v.end(), v4.begin()) );
+
+ iterator_type it5 = v.erase(v.begin() + 2);
+ VERIFY( it5 == v.begin() + 2 );
+ VERIFY( v.size() == N5 );
+ VERIFY( std::equal(v.begin(), v.end(), v5.begin()) );
+
+ iterator_type it6 = v.erase(v.begin(), v.end());
+ VERIFY( it6 == v.begin() );
+ VERIFY( v.empty() );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/50529.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/50529.cc
new file mode 100644
index 000000000..d76bed53c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/50529.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2011-09-26 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <vector>
+#include <testsuite_rvalref.h>
+
+// libstdc++/50529
+void test01()
+{
+ std::vector<__gnu_test::rvalstruct> v(10);
+
+ for (auto it = v.begin(); it != v.end(); ++it)
+ v.erase(it, it);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/moveable.cc
new file mode 100644
index 000000000..9e0c5597e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/moveable.cc
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-28 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 <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace __gnu_test;
+
+ std::vector<copycounter> a(40);
+ copycounter::copycount = 0;
+
+ a.erase(a.begin() + 20);
+ VERIFY( copycounter::copycount == 0 );
+
+ a.erase(a.begin());
+ VERIFY( copycounter::copycount == 0 );
+
+ a.erase(a.end() - 1);
+ VERIFY( copycounter::copycount == 0 );
+
+ a.erase(a.begin() + 10, a.end() - 10);
+ VERIFY( copycounter::copycount == 0 );
+
+ a.erase(a.begin(), a.begin() + 5);
+ VERIFY( copycounter::copycount == 0 );
+
+ a.erase(a.end() - 5, a.end());
+ VERIFY( copycounter::copycount == 0 );
+
+ a.erase(a.begin(), a.end());
+ VERIFY( copycounter::copycount == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/1.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/1.cc
new file mode 100644
index 000000000..dfd092dc5
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/1.cc
@@ -0,0 +1,49 @@
+// 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 <vector>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ vector<int> iv;
+
+ try
+ {
+ iv.insert(iv.end(), iv.max_size() + 1, 1);
+ }
+ catch(std::length_error&)
+ {
+ VERIFY( true );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/moveable.cc
new file mode 100644
index 000000000..969cb1c92
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/moveable.cc
@@ -0,0 +1,137 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2005, 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/>.
+
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_rvalref.h>
+
+using namespace __gnu_test;
+
+// Test vector::push_back makes no unneeded copies.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<copycounter> a;
+ copycounter c(1);
+ copycounter::copycount = 0;
+ for(int i = 0; i < 10; ++i)
+ a.push_back(c);
+ VERIFY(copycounter::copycount == 10);
+
+ for(int i = 0; i < 100; ++i)
+ a.insert(a.begin() + i, c);
+ VERIFY(copycounter::copycount == 110);
+
+ for(int i = 0; i < 1000; ++i)
+ a.insert(a.end(), c);
+ VERIFY(copycounter::copycount == 1110);
+}
+
+// Test vector::insert(iterator, iterator, iterator) makes no unneeded copies
+// when it has to also reallocate the vector's internal buffer.
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ copycounter c(1);
+ std::vector<copycounter> a(10, c), b(100, c);
+ copycounter::copycount = 0;
+ a.insert(a.begin(), b.begin(), b.begin() + 20);
+ VERIFY(copycounter::copycount == 20);
+ a.insert(a.end(), b.begin(), b.begin() + 50);
+ VERIFY(copycounter::copycount == 70);
+ a.insert(a.begin() + 50, b.begin(), b.end());
+ VERIFY(copycounter::copycount == 170);
+}
+
+// Test vector::insert(iterator, iterator, iterator) makes no unneeded copies
+// when it doesn't have to reallocate the vector's internal buffer.
+void
+test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ copycounter c(1);
+ std::vector<copycounter> a(10, c), b(100, c);
+ copycounter::copycount = 0;
+ a.reserve(1000);
+ VERIFY(copycounter::copycount == 0);
+ a.insert(a.begin(), b.begin(), b.begin() + 20);
+ VERIFY(copycounter::copycount == 20);
+ a.insert(a.end(), b.begin(), b.begin() + 50);
+ VERIFY(copycounter::copycount == 70);
+ a.insert(a.begin() + 50, b.begin(), b.end());
+ VERIFY(copycounter::copycount == 170);
+}
+
+// Test vector::insert(iterator, count, value) makes no unneeded copies
+// when it has to also reallocate the vector's internal buffer.
+void
+test04()
+{
+ bool test __attribute__((unused)) = true;
+
+ copycounter c(1);
+ std::vector<copycounter> a(10, c);
+ copycounter::copycount = 0;
+ a.insert(a.begin(), 20, c);
+ VERIFY(copycounter::copycount == 20);
+ a.insert(a.end(), 50, c);
+ VERIFY(copycounter::copycount == 70);
+ a.insert(a.begin() + 50, 100, c);
+ VERIFY(copycounter::copycount == 170);
+}
+
+// Test vector::insert(iterator, count, value) makes no unneeded copies
+// when it doesn't have to reallocate the vector's internal buffer.
+void
+test05()
+{
+ bool test __attribute__((unused)) = true;
+
+ copycounter c(1);
+ std::vector<copycounter> a(10, c);
+ copycounter::copycount = 0;
+ a.reserve(1000);
+ a.insert(a.begin(), 20, c);
+ // NOTE : These values are each one higher than might be expected, as
+ // vector::insert(iterator, count, value) copies the value it is given
+ // when it doesn't reallocate the buffer.
+ VERIFY(copycounter::copycount == 20 + 1);
+ a.insert(a.end(), 50, c);
+ VERIFY(copycounter::copycount == 70 + 2);
+ a.insert(a.begin() + 50, 100, c);
+ VERIFY(copycounter::copycount == 170 + 3);
+}
+
+
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/1.cc
new file mode 100644
index 000000000..f4fd4d8d6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/1.cc
@@ -0,0 +1,62 @@
+// Copyright (C) 2004, 2005, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+struct T { int i; };
+
+int swap_calls;
+
+namespace std
+{
+ template<>
+ void
+ vector<T, allocator<T> >::swap(vector<T, allocator<T> >&)
+ { ++swap_calls; }
+}
+
+// Should use vector specialization for swap.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::vector<T> A;
+ std::vector<T> B;
+ swap_calls = 0;
+ std::swap(A, B);
+ VERIFY(1 == swap_calls);
+}
+
+// Should use vector specialization for swap.
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+ vector<T> A;
+ vector<T> B;
+ swap_calls = 0;
+ swap(A, B);
+ VERIFY(1 == swap_calls);
+}
+
+// See c++/13658 for background info.
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/2.cc
new file mode 100644
index 000000000..e86f09416
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/2.cc
@@ -0,0 +1,132 @@
+// 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.4.3 vector::swap
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator as a non-empty allocator.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef __gnu_test::uneq_allocator<char> my_alloc;
+ typedef vector<char, my_alloc> my_vector;
+
+ 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);
+
+ my_vector::size_type size01, size02;
+
+ my_alloc alloc01(1);
+
+ my_vector vec01(alloc01);
+ size01 = vec01.size();
+ my_vector vec02(alloc01);
+ size02 = vec02.size();
+
+ vec01.swap(vec02);
+ VERIFY( vec01.size() == size02 );
+ VERIFY( vec01.empty() );
+ VERIFY( vec02.size() == size01 );
+ VERIFY( vec02.empty() );
+
+ my_vector vec03(alloc01);
+ size01 = vec03.size();
+ my_vector vec04(title02, title02 + N2, alloc01);
+ size02 = vec04.size();
+
+ vec03.swap(vec04);
+ VERIFY( vec03.size() == size02 );
+ VERIFY( equal(vec03.begin(), vec03.end(), title02) );
+ VERIFY( vec04.size() == size01 );
+ VERIFY( vec04.empty() );
+
+ my_vector vec05(title01, title01 + N1, alloc01);
+ size01 = vec05.size();
+ my_vector vec06(title02, title02 + N2, alloc01);
+ size02 = vec06.size();
+
+ vec05.swap(vec06);
+ VERIFY( vec05.size() == size02 );
+ VERIFY( equal(vec05.begin(), vec05.end(), title02) );
+ VERIFY( vec06.size() == size01 );
+ VERIFY( equal(vec06.begin(), vec06.end(), title01) );
+
+ my_vector vec07(title01, title01 + N1, alloc01);
+ size01 = vec07.size();
+ my_vector vec08(title03, title03 + N3, alloc01);
+ size02 = vec08.size();
+
+ vec07.swap(vec08);
+ VERIFY( vec07.size() == size02 );
+ VERIFY( equal(vec07.begin(), vec07.end(), title03) );
+ VERIFY( vec08.size() == size01 );
+ VERIFY( equal(vec08.begin(), vec08.end(), title01) );
+
+ my_vector vec09(title03, title03 + N3, alloc01);
+ size01 = vec09.size();
+ my_vector vec10(title04, title04 + N4, alloc01);
+ size02 = vec10.size();
+
+ vec09.swap(vec10);
+ VERIFY( vec09.size() == size02 );
+ VERIFY( equal(vec09.begin(), vec09.end(), title04) );
+ VERIFY( vec10.size() == size01 );
+ VERIFY( equal(vec10.begin(), vec10.end(), title03) );
+
+ my_vector vec11(title04, title04 + N4, alloc01);
+ size01 = vec11.size();
+ my_vector vec12(title01, title01 + N1, alloc01);
+ size02 = vec12.size();
+
+ vec11.swap(vec12);
+ VERIFY( vec11.size() == size02 );
+ VERIFY( equal(vec11.begin(), vec11.end(), title01) );
+ VERIFY( vec12.size() == size01 );
+ VERIFY( equal(vec12.begin(), vec12.end(), title04) );
+
+ my_vector vec13(title03, title03 + N3, alloc01);
+ size01 = vec13.size();
+ my_vector vec14(title03, title03 + N3, alloc01);
+ size02 = vec14.size();
+
+ vec13.swap(vec14);
+ VERIFY( vec13.size() == size02 );
+ VERIFY( equal(vec13.begin(), vec13.end(), title03) );
+ VERIFY( vec14.size() == size01 );
+ VERIFY( equal(vec14.begin(), vec14.end(), title03) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/3.cc
new file mode 100644
index 000000000..1809dd069
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap/3.cc
@@ -0,0 +1,161 @@
+// 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.4.3 vector::swap
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator, two different personalities.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef __gnu_test::uneq_allocator<char> my_alloc;
+ typedef vector<char, my_alloc> my_vector;
+
+ 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);
+
+ my_vector::size_type size01, size02;
+
+ my_alloc alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ my_vector vec01(alloc01);
+ size01 = vec01.size();
+ personality01 = vec01.get_allocator().get_personality();
+ my_vector vec02(alloc02);
+ size02 = vec02.size();
+ personality02 = vec02.get_allocator().get_personality();
+
+ vec01.swap(vec02);
+ VERIFY( vec01.size() == size02 );
+ VERIFY( vec01.empty() );
+ VERIFY( vec02.size() == size01 );
+ VERIFY( vec02.empty() );
+ VERIFY( vec01.get_allocator().get_personality() == personality02 );
+ VERIFY( vec02.get_allocator().get_personality() == personality01 );
+
+ my_vector vec03(alloc02);
+ size01 = vec03.size();
+ personality01 = vec03.get_allocator().get_personality();
+ my_vector vec04(title02, title02 + N2, alloc01);
+ size02 = vec04.size();
+ personality02 = vec04.get_allocator().get_personality();
+
+ vec03.swap(vec04);
+ VERIFY( vec03.size() == size02 );
+ VERIFY( equal(vec03.begin(), vec03.end(), title02) );
+ VERIFY( vec04.size() == size01 );
+ VERIFY( vec04.empty() );
+ VERIFY( vec03.get_allocator().get_personality() == personality02 );
+ VERIFY( vec04.get_allocator().get_personality() == personality01 );
+
+ my_vector vec05(title01, title01 + N1, alloc01);
+ size01 = vec05.size();
+ personality01 = vec05.get_allocator().get_personality();
+ my_vector vec06(title02, title02 + N2, alloc02);
+ size02 = vec06.size();
+ personality02 = vec06.get_allocator().get_personality();
+
+ vec05.swap(vec06);
+ VERIFY( vec05.size() == size02 );
+ VERIFY( equal(vec05.begin(), vec05.end(), title02) );
+ VERIFY( vec06.size() == size01 );
+ VERIFY( equal(vec06.begin(), vec06.end(), title01) );
+ VERIFY( vec05.get_allocator().get_personality() == personality02 );
+ VERIFY( vec06.get_allocator().get_personality() == personality01 );
+
+ my_vector vec07(title01, title01 + N1, alloc02);
+ size01 = vec07.size();
+ personality01 = vec07.get_allocator().get_personality();
+ my_vector vec08(title03, title03 + N3, alloc01);
+ size02 = vec08.size();
+ personality02 = vec08.get_allocator().get_personality();
+
+ vec07.swap(vec08);
+ VERIFY( vec07.size() == size02 );
+ VERIFY( equal(vec07.begin(), vec07.end(), title03) );
+ VERIFY( vec08.size() == size01 );
+ VERIFY( equal(vec08.begin(), vec08.end(), title01) );
+ VERIFY( vec07.get_allocator().get_personality() == personality02 );
+ VERIFY( vec08.get_allocator().get_personality() == personality01 );
+
+ my_vector vec09(title03, title03 + N3, alloc01);
+ size01 = vec09.size();
+ personality01 = vec09.get_allocator().get_personality();
+ my_vector vec10(title04, title04 + N4, alloc02);
+ size02 = vec10.size();
+ personality02 = vec10.get_allocator().get_personality();
+
+ vec09.swap(vec10);
+ VERIFY( vec09.size() == size02 );
+ VERIFY( equal(vec09.begin(), vec09.end(), title04) );
+ VERIFY( vec10.size() == size01 );
+ VERIFY( equal(vec10.begin(), vec10.end(), title03) );
+ VERIFY( vec09.get_allocator().get_personality() == personality02 );
+ VERIFY( vec10.get_allocator().get_personality() == personality01 );
+
+ my_vector vec11(title04, title04 + N4, alloc02);
+ size01 = vec11.size();
+ personality01 = vec11.get_allocator().get_personality();
+ my_vector vec12(title01, title01 + N1, alloc01);
+ size02 = vec12.size();
+ personality02 = vec12.get_allocator().get_personality();
+
+ vec11.swap(vec12);
+ VERIFY( vec11.size() == size02 );
+ VERIFY( equal(vec11.begin(), vec11.end(), title01) );
+ VERIFY( vec12.size() == size01 );
+ VERIFY( equal(vec12.begin(), vec12.end(), title04) );
+ VERIFY( vec11.get_allocator().get_personality() == personality02 );
+ VERIFY( vec12.get_allocator().get_personality() == personality01 );
+
+ my_vector vec13(title03, title03 + N3, alloc01);
+ size01 = vec13.size();
+ personality01 = vec13.get_allocator().get_personality();
+ my_vector vec14(title03, title03 + N3, alloc02);
+ size02 = vec14.size();
+ personality02 = vec14.get_allocator().get_personality();
+
+ vec13.swap(vec14);
+ VERIFY( vec13.size() == size02 );
+ VERIFY( equal(vec13.begin(), vec13.end(), title03) );
+ VERIFY( vec14.size() == size01 );
+ VERIFY( equal(vec14.begin(), vec14.end(), title03) );
+ VERIFY( vec13.get_allocator().get_personality() == personality02 );
+ VERIFY( vec14.get_allocator().get_personality() == personality01 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc b/libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc
new file mode 100644
index 000000000..1e9d01afe
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/profile/vector.cc
@@ -0,0 +1,18 @@
+// Test vector: performance difference 25% (0.444s vs 0.539s)
+// Advice: set tmp as 10000
+
+#include <vector>
+
+using std::vector;
+
+int main()
+{
+ vector <int> tmp;
+
+ for (int j=0; j<2000; j++)
+ // Insert more than default item
+ for (int i=0; i<10000; i++) {
+ tmp.push_back(i);
+ }
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/vector/range_access.cc b/libstdc++-v3/testsuite/23_containers/vector/range_access.cc
new file mode 100644
index 000000000..cbcbf6144
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/range_access.cc
@@ -0,0 +1,35 @@
+// { 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 <vector>
+
+void
+test01()
+{
+ std::vector<double> v{1.0, 2.0, 3.0};
+ std::begin(v);
+ std::end(v);
+
+ std::vector<bool> vb{true, false, true};
+ std::begin(vb);
+ std::end(vb);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc
new file mode 100644
index 000000000..eee16b04e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <testsuite_containers.h>
+
+int main()
+{
+ typedef std::vector<int> test_type;
+ __gnu_test::citerator<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
new file mode 100644
index 000000000..f13dd0163
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -0,0 +1,35 @@
+// 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 *-*-* } 1150 }
+// { dg-excess-errors "" }
+
+#include <vector>
+
+struct A
+{
+ explicit A(int) { }
+};
+
+void f()
+{
+ std::vector<A> v;
+ v.assign(10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor.cc
new file mode 100644
index 000000000..959e7a8ea
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor.cc
@@ -0,0 +1,27 @@
+// 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 <vector>
+
+void f()
+{
+ std::vector<int> v(10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
new file mode 100644
index 000000000..471d4589b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -0,0 +1,29 @@
+// 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 *-*-* } 1080 }
+// { dg-excess-errors "" }
+
+#include <vector>
+
+void f()
+{
+ std::vector<std::vector<int> > v(10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
new file mode 100644
index 000000000..8d1b72c63
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_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 *-*-* } 1080 }
+// { dg-excess-errors "" }
+
+#include <vector>
+#include <utility>
+
+void f()
+{
+ std::vector<std::vector<std::pair<char, char> > > v('a', 'b');
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
new file mode 100644
index 000000000..2f10c5503
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -0,0 +1,35 @@
+// 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 *-*-* } 1191 }
+// { dg-excess-errors "" }
+
+#include <vector>
+
+struct A
+{
+ explicit A(int) { }
+};
+
+void f()
+{
+ std::vector<A> v;
+ v.insert(v.begin(), 10, 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/exception/basic.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/exception/basic.cc
new file mode 100644
index 000000000..a31a05a06
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#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::vector<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/vector/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/exception/generation_prohibited.cc
new file mode 100644
index 000000000..acd2c211d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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, 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 <vector>
+#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::vector<value_type, allocator_type> test_type;
+ __gnu_test::generation_prohibited<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/exception/propagation_consistent.cc
new file mode 100644
index 000000000..7487ac372
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <exception/safety.h>
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ typedef __gnu_cxx::throw_value_limit value_type;
+ typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+ typedef std::vector<value_type, allocator_type> test_type;
+ __gnu_test::propagation_consistent<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000..5310ec4f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+
+// { dg-do compile }
+
+template class std::vector<int>;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/1_c++0x.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/1_c++0x.cc
new file mode 100644
index 000000000..2e5787702
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+
+template class std::vector<int>;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/2.cc
new file mode 100644
index 000000000..4ec749b73
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+#include <testsuite_api.h>
+
+// { dg-do compile }
+
+// N.B. In C++0x mode we cannot instantiate with T == NonDefaultConstructible
+// because of 23.4.1.1.4
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+template class std::vector<__gnu_test::NonDefaultConstructible>;
+#endif
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/3.cc
new file mode 100644
index 000000000..0256b086a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+
+// { dg-do compile }
+
+// libstdc++/21770
+template class std::vector<int, std::allocator<char> >;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/4.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/4.cc
new file mode 100644
index 000000000..9305e3c87
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/4.cc
@@ -0,0 +1,29 @@
+// 2010-05-20 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// This file tests explicit instantiation of library containers
+
+#include <vector>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+// { dg-do compile }
+
+// libstdc++/41792
+template class std::vector<__gnu_test::OverloadedAddress>;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/partial_specialization/1.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/partial_specialization/1.cc
new file mode 100644
index 000000000..00db9cecb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/partial_specialization/1.cc
@@ -0,0 +1,33 @@
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// This file tests user specialization of library containers
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+// { dg-do compile }
+
+struct user_type {};
+
+namespace std
+{
+ template<typename Allocator>
+ class vector<user_type, Allocator> {};
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/typedefs.cc
new file mode 100644
index 000000000..24897ff3a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/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 <vector>
+
+// Check container for required typedefs.
+__gnu_test::types<std::vector<int> > t;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/types/1.cc b/libstdc++-v3/testsuite/23_containers/vector/types/1.cc
new file mode 100644
index 000000000..dd2f8f646
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/types/1.cc
@@ -0,0 +1,41 @@
+// 2005-12-01 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 }
+
+#include <vector>
+#include <testsuite_greedy_ops.h>
+
+int main()
+{
+ std::vector<greedy_ops::X> v(5);
+ const std::vector<greedy_ops::X> w(1);
+
+ v[0];
+ w[0];
+ v.size();
+ v.capacity();
+ v.resize(1);
+ v.insert(v.begin(), greedy_ops::X());
+ v.insert(v.begin(), 1, greedy_ops::X());
+ v.insert(v.begin(), w.begin(), w.end());
+ v = w;
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/types/23767.cc b/libstdc++-v3/testsuite/23_containers/vector/types/23767.cc
new file mode 100644
index 000000000..6e178d728
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/types/23767.cc
@@ -0,0 +1,43 @@
+// 2005-09-12 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/>.
+//
+
+// { dg-do compile }
+
+#include <vector>
+
+struct T
+{
+ typedef std::vector<int> Vector;
+ typedef Vector::iterator iterator;
+ typedef Vector::const_iterator const_iterator;
+
+ int t(iterator f) { return *f; }
+ int t(const_iterator f) const { return *f; }
+};
+
+// libstdc++/23767
+void f()
+{
+ std::vector<int> v;
+ T t;
+ T::const_iterator i = v.begin();
+
+ t.t(i);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc b/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc
new file mode 100644
index 000000000..7441cf89d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc
@@ -0,0 +1,68 @@
+// 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 <vector>
+#include <cstdlib>
+#include <testsuite_hooks.h>
+
+unsigned int zero_sized_news = 0;
+
+void *operator new(size_t size) throw (std::bad_alloc)
+{
+ /* malloc(0) is unpredictable; avoid it. */
+ if (size == 0)
+ {
+ size = 1;
+ ++zero_sized_news;
+ }
+
+ void *p = std::malloc(size);
+
+ if (p == 0)
+ throw std::bad_alloc();
+
+ return p;
+}
+
+void operator delete(void *ptr) throw()
+{
+ if (ptr != 0)
+ std::free(ptr);
+}
+
+// http://gcc.gnu.org/ml/libstdc++/2007-09/msg00006.html
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<std::vector<int> > *v;
+ VERIFY( zero_sized_news == 0 );
+
+ v = new std::vector<std::vector<int> >;
+ VERIFY( zero_sized_news == 0 );
+
+ v->resize(10);
+ delete(v);
+ VERIFY( zero_sized_news == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}