summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/24_iterators
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/24_iterators
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/24_iterators')
-rw-r--r--libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc38
-rw-r--r--libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/base_classes.cc36
-rw-r--r--libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/container.cc33
-rw-r--r--libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/explicit_instantiation.cc27
-rw-r--r--libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/typedefs.cc38
-rw-r--r--libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc37
-rw-r--r--libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/base_classes.cc36
-rw-r--r--libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/container.cc33
-rw-r--r--libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/explicit_instantiation.cc27
-rw-r--r--libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/typedefs.cc38
-rw-r--r--libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc33
-rw-r--r--libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis.cc127
-rw-r--r--libstdc++-v3/testsuite/24_iterators/headers/iterator/types_std.cc29
-rw-r--r--libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc41
-rw-r--r--libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/base_classes.cc39
-rw-r--r--libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/container.cc34
-rw-r--r--libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/explicit_instantiation.cc27
-rw-r--r--libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/typedefs.cc39
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istream_iterator/2.cc64
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc29
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/base_classes.cc37
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/explicit_instantiation.cc28
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/typedefs.cc42
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2.cc116
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2627.cc66
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc29
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/base_classes.cc39
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/explicit_instantiation.cc27
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/typedefs.cc43
-rw-r--r--libstdc++-v3/testsuite/24_iterators/move_iterator/greedy_ops.cc44
-rw-r--r--libstdc++-v3/testsuite/24_iterators/normal_iterator/greedy_ops.cc52
-rw-r--r--libstdc++-v3/testsuite/24_iterators/operations/40497.cc41
-rw-r--r--libstdc++-v3/testsuite/24_iterators/operations/next.cc54
-rw-r--r--libstdc++-v3/testsuite/24_iterators/operations/prev.cc54
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/base_classes.cc37
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/explicit_instantiation.cc28
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/typedefs.cc42
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc91
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/base_classes.cc37
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/explicit_instantiation.cc26
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/typedefs.cc43
-rw-r--r--libstdc++-v3/testsuite/24_iterators/random_access_iterator/26020.cc44
-rw-r--r--libstdc++-v3/testsuite/24_iterators/random_access_iterator/string_vector_iterators.cc607
-rw-r--r--libstdc++-v3/testsuite/24_iterators/range_access.cc31
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/11729.cc72
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/2.cc45
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/3.cc39
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/greedy_ops.cc43
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/base_classes.cc40
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/current.cc31
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/explicit_instantiation.cc26
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/typedefs.cc36
52 files changed, 2795 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc
new file mode 100644
index 000000000..2c967ac27
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/2.cc
@@ -0,0 +1,38 @@
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2004, 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/>.
+
+// 24.4.2.1 Template class back_insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test02()
+{
+ typedef std::back_insert_iterator<std::list<int> > iterator_type;
+ std::list<int> li;
+ iterator_type it = std::back_inserter(li);
+ it = it; // Suppress unused warning.
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/base_classes.cc b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/base_classes.cc
new file mode 100644
index 000000000..332e79dc6
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/base_classes.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.4.2.1 Template class back_insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ list<int> l;
+ typedef back_insert_iterator<list<int> > test_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ test_iterator r_it(l);
+ base_iterator* base __attribute__((unused)) = &r_it;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/container.cc b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/container.cc
new file mode 100644
index 000000000..a3deb0fbc
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/container.cc
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.4.2.1 Template class back_insert_iterator
+
+#include <iterator>
+#include <list>
+
+// Check data member 'container' accessible.
+class test_dm : public std::back_insert_iterator<std::list<int> >
+{
+ container_type l;
+ container_type* p;
+public:
+ test_dm(): std::back_insert_iterator<std::list<int> >(l), p(container) { }
+};
diff --git a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..c92070ddf
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/explicit_instantiation.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.4.2.1 Template class back_insert_iterator
+
+#include <iterator>
+#include <list>
+
+// Make sure iterator can be instantiated.
+template class std::back_insert_iterator<std::list<int> >;
diff --git a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/typedefs.cc
new file mode 100644
index 000000000..c8aaf9551
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator/requirements/typedefs.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.4.2.1 Template class back_insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required typedefs
+ typedef back_insert_iterator<list<int> > test_iterator;
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+ typedef test_iterator::container_type container_type;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc
new file mode 100644
index 000000000..e72723764
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/2.cc
@@ -0,0 +1,37 @@
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 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/>.
+
+// 24.4.2.3 Template class front_insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test02()
+{
+ typedef std::front_insert_iterator<std::list<int> > iterator_type;
+ std::list<int> li;
+ iterator_type it = std::front_inserter(li);
+ it = it; // Suppress unused warning.
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/base_classes.cc b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/base_classes.cc
new file mode 100644
index 000000000..3800fd308
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/base_classes.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.4.2.3 Template class front_insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ list<int> l;
+ typedef front_insert_iterator<list<int> > test_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ test_iterator r_it(l);
+ base_iterator* base __attribute__((unused)) = &r_it;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/container.cc b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/container.cc
new file mode 100644
index 000000000..ca2b03e80
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/container.cc
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.4.2.3 Template class front_insert_iterator
+
+#include <iterator>
+#include <list>
+
+// Check data member 'container' accessible.
+class test_dm : public std::front_insert_iterator<std::list<int> >
+{
+ container_type l;
+ container_type* p;
+public:
+ test_dm(): std::front_insert_iterator<std::list<int> >(l), p(container) { }
+};
diff --git a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..aaca2e78d
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/explicit_instantiation.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.4.2.3 Template class front_insert_iterator
+
+#include <iterator>
+#include <list>
+
+// Make sure iterator can be instantiated.
+template class std::front_insert_iterator<std::list<int> >;
diff --git a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/typedefs.cc
new file mode 100644
index 000000000..f3cbbe672
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator/requirements/typedefs.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.4.2.3 Template class front_insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required typedefs
+ typedef front_insert_iterator<list<int> > test_iterator;
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+ typedef test_iterator::container_type container_type;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc
new file mode 100644
index 000000000..8082e0d06
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc
@@ -0,0 +1,33 @@
+// { 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/>.
+
+#include <iterator>
+
+namespace std
+{
+ template<class C> auto begin(C& c) -> decltype(c.begin());
+ template<class C> auto begin(const C& c) -> decltype(c.begin());
+
+ template<class C> auto end(C& c) -> decltype(c.end());
+ template<class C> auto end(const C& c) -> decltype(c.end());
+
+ template<class T, size_t N> T* begin(T (&array)[N]);
+ template<class T, size_t N> T* end(T (&array)[N]);
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis.cc
new file mode 100644
index 000000000..27cb40e03
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis.cc
@@ -0,0 +1,127 @@
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+
+namespace std {
+
+ // 24.3, primitives:
+ template<class Iterator> struct iterator_traits;
+ template<class T> struct iterator_traits<T*>;
+
+ template<class Category, class T, class Distance,
+ class Pointer, class Reference> struct iterator;
+
+ struct input_iterator_tag;
+ struct output_iterator_tag;
+ struct forward_iterator_tag;
+ struct bidirectional_iterator_tag;
+ struct random_access_iterator_tag;
+
+ // 24.3.4, iterator operations:
+ template <class InputIterator, class Distance>
+ void
+ advance(InputIterator& i, Distance n);
+
+ template <class InputIterator>
+ typename iterator_traits<InputIterator>::difference_type
+ distance(InputIterator first, InputIterator last);
+
+ // 24.4, predefined iterators:
+ template <class Iterator> class reverse_iterator;
+
+ template <class Iterator>
+ bool operator==(const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+
+ template <class Iterator>
+ bool operator<(const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+
+ template <class Iterator>
+ bool operator!=(const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+
+ template <class Iterator>
+ bool operator>(const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+
+ template <class Iterator>
+ bool operator>=(const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+
+ template <class Iterator>
+ bool operator<=(const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+
+ template <class Iterator>
+ typename reverse_iterator<Iterator>::difference_type
+ operator-(const reverse_iterator<Iterator>& x,
+ const reverse_iterator<Iterator>& y);
+
+ template <class Iterator>
+ reverse_iterator<Iterator>
+ operator+(typename reverse_iterator<Iterator>::difference_type n,
+ const reverse_iterator<Iterator>& x);
+
+ template <class Container> class back_insert_iterator;
+
+ template <class Container>
+ back_insert_iterator<Container> back_inserter(Container& x);
+
+ template <class Container> class front_insert_iterator;
+
+ template <class Container>
+ front_insert_iterator<Container> front_inserter(Container& x);
+
+ template <class Container> class insert_iterator;
+
+ template <class Container, class Iterator>
+ insert_iterator<Container> inserter(Container& x, Iterator i);
+
+ // 24.5, stream iterators:
+ template <class T, class charT, class traits, class Distance>
+ class istream_iterator;
+
+ template <class T, class charT, class traits, class Distance>
+ bool operator==(const istream_iterator<T,charT,traits,Distance>& x,
+ const istream_iterator<T,charT,traits,Distance>& y);
+
+ template <class T, class charT, class traits, class Distance>
+ bool operator!=(const istream_iterator<T,charT,traits,Distance>& x,
+ const istream_iterator<T,charT,traits,Distance>& y);
+
+ template <class T, class charT, class traits>
+ class ostream_iterator;
+
+ template<class charT, class traits>
+ class istreambuf_iterator;
+
+ template <class charT, class traits>
+ bool
+ operator==(const istreambuf_iterator<charT,traits>&,
+ const istreambuf_iterator<charT,traits>&);
+
+ template <class charT, class traits>
+ bool operator!=(const istreambuf_iterator<charT,traits>&,
+ const istreambuf_iterator<charT,traits>&);
+
+ template <class charT, class traits>
+ class ostreambuf_iterator;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/types_std.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/types_std.cc
new file mode 100644
index 000000000..4b01c962a
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/types_std.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+
+namespace gnu
+{
+ typedef std::input_iterator_tag t1;
+ typedef std::output_iterator_tag t2;
+ typedef std::forward_iterator_tag t3;
+ typedef std::bidirectional_iterator_tag t4;
+ typedef std::random_access_iterator_tag t5;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc
new file mode 100644
index 000000000..ac949307e
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator/2.cc
@@ -0,0 +1,41 @@
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 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/>.
+
+// 24.4.2.5 Template class insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test02()
+{
+ typedef std::insert_iterator<std::list<int> > iterator_type;
+
+ std::list<int> li;
+ std::list<int>::iterator liit = li.begin();
+ iterator_type it01(li, liit);
+ iterator_type it02 = std::inserter(li, liit);
+ it01 = it01; // Suppress unused warnings.
+ it02 = it02;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/base_classes.cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/base_classes.cc
new file mode 100644
index 000000000..74675d951
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/base_classes.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.4.2.5 Template class insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ list<int> l;
+ list<int>::iterator li = l.begin();
+
+ typedef insert_iterator<list<int> > test_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ test_iterator r_it(l, li);
+ base_iterator* base __attribute__((unused)) = &r_it;
+}
+
diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/container.cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/container.cc
new file mode 100644
index 000000000..845d76b1d
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/container.cc
@@ -0,0 +1,34 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.4.2.5 Template class insert_iterator
+
+#include <iterator>
+#include <list>
+
+// Check data member 'container' accessible.
+class test_dm : public std::insert_iterator<std::list<int> >
+{
+ container_type l;
+ container_type::iterator i;
+ container_type* p;
+public:
+ test_dm(): std::insert_iterator<std::list<int> >(l, i), p(container) { }
+};
diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..7f1e5ae74
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/explicit_instantiation.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.4.2.5 Template class insert_iterator
+
+#include <iterator>
+#include <list>
+
+// Make sure iterator can be instantiated.
+template class std::insert_iterator<std::list<int> >;
diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/typedefs.cc
new file mode 100644
index 000000000..05d142ab3
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator/requirements/typedefs.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.4.2.5 Template class insert_iterator
+
+#include <iterator>
+#include <list>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required typedefs
+ typedef insert_iterator<list<int> > test_iterator;
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+ typedef test_iterator::container_type container_type;
+}
+
diff --git a/libstdc++-v3/testsuite/24_iterators/istream_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/istream_iterator/2.cc
new file mode 100644
index 000000000..b84924a30
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istream_iterator/2.cc
@@ -0,0 +1,64 @@
+// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.1 Template class istream_iterator
+
+#include <iterator>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ string st("R.Rorty");
+
+ string re_01, re_02, re_03;
+ re_02 = ",H.Putnam";
+ re_03 = "D.Dennett,xxx,H.Putnam";
+
+ stringbuf sb_01(st);
+ istream is_01(&sb_01);
+ istream_iterator<char> inb_01(is_01);
+ istream_iterator<char> ine_01;
+ re_01.assign(inb_01, ine_01);
+ VERIFY( re_01 == "R.Rorty" );
+
+ stringbuf sb_02(st);
+ istream is_02(&sb_02);
+ istream_iterator<char> inb_02(is_02);
+ istream_iterator<char> ine_02;
+ re_02.insert(re_02.begin(), inb_02, ine_02);
+ VERIFY( re_02 == "R.Rorty,H.Putnam" );
+
+ stringbuf sb_03(st);
+ istream is_03(&sb_03);
+ istream_iterator<char> inb_03(is_03);
+ istream_iterator<char> ine_03;
+ re_03.replace(re_03.begin() + 10, re_03.begin() + 13,
+ inb_03, ine_03);
+ VERIFY( re_03 == "D.Dennett,R.Rorty,H.Putnam" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc b/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc
new file mode 100644
index 000000000..20b419973
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc
@@ -0,0 +1,29 @@
+// { 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/>.
+
+#include <iterator>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::istream_iterator<char>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/base_classes.cc b/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/base_classes.cc
new file mode 100644
index 000000000..f03c39022
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/base_classes.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.1 Template class istream_iterator
+
+#include <iterator>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ typedef istream_iterator<long> test_iterator;
+ typedef iterator<input_iterator_tag, long, ptrdiff_t, const long*,
+ const long&> base_iterator;
+ test_iterator r_it;
+ base_iterator* base __attribute__((unused)) = &r_it;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..6e3ac3dda
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/explicit_instantiation.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.1 Template class istream_iterator
+
+#include <iterator>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// Instantiate
+template class std::istream_iterator<char>;
diff --git a/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/typedefs.cc
new file mode 100644
index 000000000..3c4613e7b
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istream_iterator/requirements/typedefs.cc
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.1 Template class istream_iterator
+
+#include <iterator>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required typedefs
+ typedef istream_iterator<long> test_iterator;
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+
+ typedef test_iterator::char_type char_type;
+ typedef test_iterator::traits_type traits_type;
+ typedef test_iterator::istream_type istream_type;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2.cc
new file mode 100644
index 000000000..4f2246fb9
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2.cc
@@ -0,0 +1,116 @@
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999, 2001, 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/>.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+bool test02(void)
+{
+
+ typedef std::istreambuf_iterator<char> cistreambuf_iter;
+ typedef cistreambuf_iter::streambuf_type cstreambuf_type;
+ bool test __attribute__((unused)) = true;
+ const char slit01[] = "playa hermosa, liberia, guanacaste";
+ std::string str01(slit01);
+ std::istringstream istrs00(str01);
+ std::istringstream istrs01(str01);
+
+ // ctor sanity checks
+ cistreambuf_iter istrb_it01(istrs00);
+ cistreambuf_iter istrb_it02;
+ std::string tmp(istrb_it01, istrb_it02);
+ VERIFY( tmp == str01 );
+
+ cistreambuf_iter istrb_it03(0);
+ cistreambuf_iter istrb_it04;
+ VERIFY( istrb_it03 == istrb_it04 );
+
+ cistreambuf_iter istrb_it05(istrs01);
+ cistreambuf_iter istrb_it06(istrs01.rdbuf());
+ VERIFY( istrb_it05 == istrb_it06 );
+
+ // bool equal(istreambuf_iter& b)
+ cistreambuf_iter istrb_it07(0);
+ cistreambuf_iter istrb_it08;
+ VERIFY( istrb_it07.equal(istrb_it08) );
+ cistreambuf_iter istrb_it09(0);
+ cistreambuf_iter istrb_it10;
+ VERIFY( istrb_it10.equal(istrb_it09) );
+
+ cistreambuf_iter istrb_it11(istrs01);
+ cistreambuf_iter istrb_it12(istrs01.rdbuf());
+ VERIFY( istrb_it11.equal(istrb_it12) );
+ cistreambuf_iter istrb_it13(istrs01);
+ cistreambuf_iter istrb_it14(istrs01.rdbuf());
+ VERIFY( istrb_it14.equal(istrb_it13) );
+
+ cistreambuf_iter istrb_it15(istrs01);
+ cistreambuf_iter istrb_it16;
+ VERIFY( !(istrb_it15.equal(istrb_it16)) );
+ cistreambuf_iter istrb_it17(istrs01);
+ cistreambuf_iter istrb_it18;
+ VERIFY( !(istrb_it18.equal(istrb_it17)) );
+
+ // bool operator==(const istreambuf_iterator&a, const istreambuf_iterator& b)
+ // bool operator!=(const istreambuf_iterator&a, const istreambuf_iterator& b)
+ cistreambuf_iter istrb_it19(0);
+ cistreambuf_iter istrb_it20;
+ VERIFY( istrb_it19 == istrb_it20 );
+
+ cistreambuf_iter istrb_it21(istrs01);
+ cistreambuf_iter istrb_it22(istrs01.rdbuf());
+ VERIFY( istrb_it22 == istrb_it21 );
+
+ cistreambuf_iter istrb_it23(istrs01);
+ cistreambuf_iter istrb_it24;
+ VERIFY( istrb_it23 != istrb_it24 );
+
+ cistreambuf_iter istrb_it25(0);
+ cistreambuf_iter istrb_it26(istrs01.rdbuf());
+ VERIFY( istrb_it25 != istrb_it26 );
+
+ // charT operator*() const
+ // istreambuf_iterator& operator++();
+ // istreambuf_iterator& operator++(int);
+ cistreambuf_iter istrb_it27(istrs01.rdbuf());
+ char c;
+ for (std::size_t i = 0; i < sizeof(slit01) - 2; ++i)
+ {
+ c = *istrb_it27++;
+ VERIFY( c == slit01[i] );
+ }
+
+ std::istringstream istrs02(str01);
+ cistreambuf_iter istrb_it28(istrs02);
+ for (std::size_t i = 0; i < sizeof(slit01) - 2;)
+ {
+ c = *++istrb_it28;
+ VERIFY( c == slit01[++i] );
+ }
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2627.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2627.cc
new file mode 100644
index 000000000..90b3ef945
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2627.cc
@@ -0,0 +1,66 @@
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999, 2001, 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/>.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+// libstdc++/2627
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ const std::string s("free the vieques");
+
+ // 1
+ std::string res_postfix;
+ std::istringstream iss01(s);
+ std::istreambuf_iterator<char> isbufit01(iss01);
+ for (std::size_t j = 0; j < s.size(); ++j, isbufit01++)
+ res_postfix += *isbufit01;
+
+ // 2
+ std::string res_prefix;
+ std::istringstream iss02(s);
+ std::istreambuf_iterator<char> isbufit02(iss02);
+ for (std::size_t j = 0; j < s.size(); ++j, ++isbufit02)
+ res_prefix += *isbufit02;
+
+ // 3 mixed
+ std::string res_mixed;
+ std::istringstream iss03(s);
+ std::istreambuf_iterator<char> isbufit03(iss03);
+ for (std::size_t j = 0; j < (s.size() / 2); ++j)
+ {
+ res_mixed += *isbufit03;
+ ++isbufit03;
+ res_mixed += *isbufit03;
+ isbufit03++;
+ }
+
+ VERIFY ( res_postfix == res_prefix );
+ VERIFY ( res_mixed == res_prefix );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc
new file mode 100644
index 000000000..0a6980ec1
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/cons/constexpr.cc
@@ -0,0 +1,29 @@
+// { 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/>.
+
+#include <iterator>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_default_constructible test;
+ test.operator()<std::istreambuf_iterator<char, std::char_traits<char>>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/base_classes.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/base_classes.cc
new file mode 100644
index 000000000..5c7274579
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/base_classes.cc
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999, 2001, 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/>.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ typedef istreambuf_iterator<char> test_iterator;
+ typedef char_traits<char>::off_type off_type;
+ typedef iterator<input_iterator_tag, char, off_type, char*, char&> base_iterator;
+
+ istringstream isstream("this tag");
+ test_iterator r_it(isstream);
+ base_iterator* base __attribute__((unused)) = &r_it;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..93c7b50d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/explicit_instantiation.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999, 2001, 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/>.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+template class std::istreambuf_iterator<char>;
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/typedefs.cc
new file mode 100644
index 000000000..2e3791c6f
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/requirements/typedefs.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999, 2001, 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/>.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required typedefs
+ typedef istreambuf_iterator<char> test_iterator;
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+
+ typedef test_iterator::char_type char_type;
+ typedef test_iterator::traits_type traits_type;
+ typedef test_iterator::istream_type istream_type;
+ typedef test_iterator::streambuf_type streambuf_type;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/move_iterator/greedy_ops.cc b/libstdc++-v3/testsuite/24_iterators/move_iterator/greedy_ops.cc
new file mode 100644
index 000000000..474a795ab
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/move_iterator/greedy_ops.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+#include <testsuite_greedy_ops.h>
+
+void test01()
+{
+ typedef std::move_iterator<greedy_ops::X*> iterator_type;
+
+ iterator_type it(nullptr);
+
+ it == it;
+ it != it;
+ it < it;
+ it <= it;
+ it > it;
+ it >= it;
+ it - it;
+ 1 + it;
+ it + 1;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/normal_iterator/greedy_ops.cc b/libstdc++-v3/testsuite/24_iterators/normal_iterator/greedy_ops.cc
new file mode 100644
index 000000000..23ad57b97
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/normal_iterator/greedy_ops.cc
@@ -0,0 +1,52 @@
+// { dg-do compile }
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+#include <testsuite_greedy_ops.h>
+
+namespace greedy_ops
+{
+ struct C
+ {
+ typedef X* pointer;
+ };
+}
+
+void test01()
+{
+ typedef __gnu_cxx::__normal_iterator<greedy_ops::X*,
+ greedy_ops::C> iterator_type;
+
+ iterator_type it(0);
+
+ it == it;
+ it != it;
+ it < it;
+ it <= it;
+ it > it;
+ it >= it;
+ it - it;
+ it + 1;
+ 1 + it;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/operations/40497.cc b/libstdc++-v3/testsuite/24_iterators/operations/40497.cc
new file mode 100644
index 000000000..59a64fbb0
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/operations/40497.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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/>.
+
+namespace X
+{
+ class C { };
+
+ template<class T> void next(T) { }
+ template<class T> void prev(T) { }
+}
+
+using namespace X;
+
+#include <iterator>
+
+using namespace std;
+
+// libstdc++/40497
+void test01()
+{
+ C c;
+ next(c);
+ prev(c);
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/operations/next.cc b/libstdc++-v3/testsuite/24_iterators/operations/next.cc
new file mode 100644
index 000000000..25eb2f296
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/operations/next.cc
@@ -0,0 +1,54 @@
+// { 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/>.
+
+// 24.3.4 Iterator operations [iterator.operations]
+
+#include <vector>
+#include <list>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::vector<int> c(3);
+ std::vector<int>::iterator i = c.begin(), j;
+
+ j = std::next(i, 3);
+ VERIFY( i == c.begin() );
+ VERIFY( j == c.end() );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ std::list<int> c(3);
+ std::list<int>::iterator i = c.begin(), j;
+
+ j = std::next(i, 3);
+ VERIFY( i == c.begin() );
+ VERIFY( j == c.end() );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/operations/prev.cc b/libstdc++-v3/testsuite/24_iterators/operations/prev.cc
new file mode 100644
index 000000000..3fcd14509
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/operations/prev.cc
@@ -0,0 +1,54 @@
+// { 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/>.
+
+// 24.3.4 Iterator operations [iterator.operations]
+
+#include <vector>
+#include <list>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::vector<int> c(3);
+ std::vector<int>::iterator i = c.end(), j;
+
+ j = std::prev(i, 3);
+ VERIFY( i == c.end() );
+ VERIFY( j == c.begin() );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ std::list<int> c(3);
+ std::list<int>::iterator i = c.end(), j;
+
+ j = std::prev(i, 3);
+ VERIFY( i == c.end() );
+ VERIFY( j == c.begin() );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/base_classes.cc b/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/base_classes.cc
new file mode 100644
index 000000000..63bf5cc6b
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/base_classes.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.4 Template class ostream_iterator
+
+#include <iterator>
+#include <ostream>
+#include <sstream>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ typedef ostream_iterator<long> test_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ ostringstream osstream("this tag");
+ test_iterator r_it(osstream);
+ base_iterator* base __attribute__((unused)) = &r_it;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..6647bed80
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/explicit_instantiation.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.4 Template class ostream_iterator
+
+#include <iterator>
+#include <ostream>
+#include <sstream>
+
+// Instantiate
+template class std::ostream_iterator<char>;
diff --git a/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/typedefs.cc
new file mode 100644
index 000000000..00a76b6e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostream_iterator/requirements/typedefs.cc
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// 2001-06-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.4 Template class ostream_iterator
+
+#include <iterator>
+#include <ostream>
+#include <sstream>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required typedefs
+ typedef ostream_iterator<long> test_iterator;
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+
+ typedef test_iterator::char_type char_type;
+ typedef test_iterator::traits_type traits_type;
+ typedef test_iterator::ostream_type ostream_type;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc
new file mode 100644
index 000000000..0b86efacb
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc
@@ -0,0 +1,91 @@
+// 2001-04-30 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003, 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/>.
+
+// 24.5.4 template class ostreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+bool test02(void)
+{
+ typedef std::ostreambuf_iterator<char> costreambuf_iter;
+ typedef costreambuf_iter::streambuf_type cstreambuf_type;
+ bool test __attribute__((unused)) = true;
+ const char slit01[] = "playa hermosa, liberia, guanacaste";
+ const char slit02[] = "bodega bay, lost coast, california";
+ std::string str01(slit01);
+ std::string str02(slit02);
+ std::string tmp;
+ std::stringbuf strbuf01;
+ std::stringbuf strbuf02(str01);
+ std::ostringstream ostrs00(str01);
+ std::ostringstream ostrs01(str01);
+
+ // ctor sanity checks
+ costreambuf_iter ostrb_it01(ostrs00);
+ VERIFY( !ostrb_it01.failed() );
+ ostrb_it01++;
+ ++ostrb_it01;
+ VERIFY( !ostrb_it01.failed() );
+ ostrb_it01 = 'a';
+ VERIFY( !ostrb_it01.failed() );
+ *ostrb_it01;
+ VERIFY( !ostrb_it01.failed() );
+
+ costreambuf_iter ostrb_it02(0);
+ VERIFY( ostrb_it02.failed() );
+ ostrb_it02++;
+ ++ostrb_it02;
+ VERIFY( ostrb_it02.failed() );
+ *ostrb_it02;
+ VERIFY( ostrb_it02.failed() );
+ ostrb_it02 = 'a';
+ VERIFY( ostrb_it02.failed() );
+
+ // charT operator*() const
+ // ostreambuf_iterator& operator++();
+ // ostreambuf_iterator& operator++(int);
+ costreambuf_iter ostrb_it27(ostrs01);
+ VERIFY( !ostrb_it27.failed() );
+ int j = str02.size();
+ for (int i = 0; i < j; ++i)
+ ostrb_it27 = str02[i];
+ VERIFY( !ostrb_it27.failed() );
+ tmp = ostrs01.str();
+ VERIFY ( tmp != str01 );
+ VERIFY ( tmp == str02 );
+
+ costreambuf_iter ostrb_it28(ostrs00);
+ VERIFY( !ostrb_it28.failed() );
+ j = ostrs00.str().size();
+ for (int i = 0; i < j + 2; ++i)
+ ostrb_it28 = 'b';
+ VERIFY( !ostrb_it28.failed() );
+ tmp = ostrs00.str();
+ VERIFY ( tmp != str01 );
+ VERIFY ( tmp != str02 );
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/base_classes.cc b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/base_classes.cc
new file mode 100644
index 000000000..a9969e386
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/base_classes.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// 2001-04-30 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.4 template class ostreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ typedef ostreambuf_iterator<char> test_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ ostringstream osstream("this tag");
+ test_iterator r_it(osstream);
+ base_iterator* base __attribute__((unused)) = &r_it;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..878f61381
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/explicit_instantiation.cc
@@ -0,0 +1,26 @@
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// This file tests explicit instantiation of library containers.
+
+#include <iterator>
+#include <sstream>
+
+template class std::ostreambuf_iterator<char>;
diff --git a/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/typedefs.cc
new file mode 100644
index 000000000..9651ee7b9
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/requirements/typedefs.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// 2001-04-30 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 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/>.
+
+// 24.5.4 template class ostreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required typedefs
+ typedef ostreambuf_iterator<char> test_iterator;
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+
+ typedef test_iterator::char_type char_type;
+ typedef test_iterator::traits_type traits_type;
+ typedef test_iterator::ostream_type ostream_type;
+ typedef test_iterator::streambuf_type streambuf_type;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/random_access_iterator/26020.cc b/libstdc++-v3/testsuite/24_iterators/random_access_iterator/26020.cc
new file mode 100644
index 000000000..aa662a0a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/random_access_iterator/26020.cc
@@ -0,0 +1,44 @@
+// 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/>.
+
+// 24.3.4 Iterator operations
+
+#include <iterator>
+#include <list>
+#include <testsuite_hooks.h>
+
+//libstdc++/26020
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ list<int> ll;
+ ll.push_back(1);
+
+ list<int>::iterator it(ll.begin());
+
+ advance(it, 0.5);
+
+ VERIFY( it == ll.begin() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/random_access_iterator/string_vector_iterators.cc b/libstdc++-v3/testsuite/24_iterators/random_access_iterator/string_vector_iterators.cc
new file mode 100644
index 000000000..add227359
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/random_access_iterator/string_vector_iterators.cc
@@ -0,0 +1,607 @@
+// 24.1.5 Random access iterators
+// 24.3.1 Iterator traits
+// (basic_string and vector implementations)
+//
+// Copyright (C) 1999, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <string>
+#include <vector>
+#include <testsuite_hooks.h>
+
+int
+string_stuff()
+{
+ int failures(0);
+
+ std::string s("abcde");
+
+ std::string::iterator i1(s.begin());
+ if (*i1 != 'a')
+ ++failures;
+
+ ++i1;
+ if (*i1 != 'b')
+ ++failures;
+
+ if (*i1++ != 'b')
+ ++failures;
+ if (*i1 != 'c')
+ ++failures;
+
+ ++ ++i1;
+ if (*i1 != 'e')
+ ++failures;
+
+ --i1;
+ if (*i1 != 'd')
+ ++failures;
+
+ if (*i1-- != 'd')
+ ++failures;
+ if (*i1 != 'c')
+ ++failures;
+
+ -- --i1;
+ if (*i1 != 'a')
+ ++failures;
+
+ std::string::iterator i2;
+ i2 = s.end();
+ std::iterator_traits<std::string::iterator>::difference_type d1;
+ d1 = i2 - i1;
+ if (d1 != 5)
+ ++failures;
+
+ std::iterator_traits<std::string::iterator>::value_type v1;
+ v1 = i1[0];
+ if (v1 != 'a')
+ ++failures;
+
+ std::iterator_traits<std::string::iterator>::reference r1(i1[0]);
+ if (r1 != 'a')
+ ++failures;
+ r1 = 'x';
+ if (r1 != 'x')
+ ++failures;
+ r1 = 'a';
+
+ if ((i1 != i2) != true)
+ ++failures;
+ if ((i1 == i2) != false)
+ ++failures;
+ if ((i1 < i2) != true)
+ ++failures;
+ if ((i1 > i2) != false)
+ ++failures;
+ if ((i1 <= i2) != true)
+ ++failures;
+ if ((i1 >= i2) != false)
+ ++failures;
+
+ std::string::iterator i3;
+ i3 = i1;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ i3 += 5;
+ if ((i3 == i2) != true)
+ ++failures;
+
+ i3 -= 5;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ if (i3 + 5 != i2)
+ ++failures;
+
+ if (5 + i3 != i2)
+ ++failures;
+
+ if (i2 - 5 != i3)
+ ++failures;
+
+ if (i1[0] != 'a')
+ ++failures;
+
+ i1[4] = 'x';
+ if (i2[-1] != 'x')
+ ++failures;
+ i1[4] = 'e';
+
+ i1[2] = 'x';
+ if (i2[-3] != 'x')
+ ++failures;
+ i1[2] = 'c';
+
+ std::string::const_iterator ci1(s.begin());
+ if (*ci1 != 'a')
+ ++failures;
+
+ ++ci1;
+ if (*ci1 != 'b')
+ ++failures;
+
+ if (*ci1++ != 'b')
+ ++failures;
+ if (*ci1 != 'c')
+ ++failures;
+
+ ++ ++ci1;
+ if (*ci1 != 'e')
+ ++failures;
+
+ --ci1;
+ if (*ci1 != 'd')
+ ++failures;
+
+ if (*ci1-- != 'd')
+ ++failures;
+ if (*ci1 != 'c')
+ ++failures;
+
+ -- --ci1;
+ if (*ci1 != 'a')
+ ++failures;
+
+ std::string::const_iterator ci2;
+ ci2 = s.end();
+ std::iterator_traits<std::string::const_iterator>::difference_type d2;
+ d2 = ci2 - ci1;
+ if (d2 != 5)
+ ++failures;
+
+ std::iterator_traits<std::string::const_iterator>::value_type v2;
+ v2 = ci1[0];
+ if (v2 != 'a')
+ ++failures;
+
+ std::iterator_traits<std::string::const_iterator>::reference r2(ci1[0]);
+ if (r2 != 'a')
+ ++failures;
+
+ if ((ci1 != ci2) != true)
+ ++failures;
+ if ((ci1 == ci2) != false)
+ ++failures;
+ if ((ci1 < ci2) != true)
+ ++failures;
+ if ((ci1 > ci2) != false)
+ ++failures;
+ if ((ci1 <= ci2) != true)
+ ++failures;
+ if ((ci1 >= ci2) != false)
+ ++failures;
+
+ std::string::const_iterator ci3;
+ ci3 = ci1;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ ci3 += 5;
+ if ((ci3 == ci2) != true)
+ ++failures;
+
+ ci3 -= 5;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ if (ci3 + 5 != ci2)
+ ++failures;
+
+ if (5 + ci3 != ci2)
+ ++failures;
+
+ if (ci2 - 5 != ci3)
+ ++failures;
+
+ if (ci1[2] != 'c')
+ ++failures;
+
+ if (ci2[-1] != 'e')
+ ++failures;
+
+ // iterator and const_iterator
+ std::string::const_iterator ci4(i1);
+ if ((ci4 == i1) != true)
+ ++failures;
+ if ((ci4 != i1) != false)
+ ++failures;
+ if ((ci4 < i1) != false)
+ ++failures;
+ if ((ci4 > i1) != false)
+ ++failures;
+ if ((ci4 <= i1) != true)
+ ++failures;
+ if ((ci4 >= i1) != true)
+ ++failures;
+ ci4 = i2;
+ if ((i2 == ci4) != true)
+ ++failures;
+ if ((i2 < ci4) != false)
+ ++failures;
+ if ((i2 > ci4) != false)
+ ++failures;
+ if ((i2 <= ci4) != true)
+ ++failures;
+ if ((i2 >= ci4) != true)
+ ++failures;
+
+ const std::string cs("ABCDE");
+ std::string::const_iterator ci5(cs.begin());
+ if (ci5[0] != 'A')
+ ++failures;
+
+ return failures;
+}
+
+int
+vector_stuff()
+{
+ int failures(0);
+
+ std::vector<int> v;
+ v.push_back(int(1));
+ v.push_back(int(2));
+ v.push_back(int(3));
+ v.push_back(int(4));
+ v.push_back(int(5));
+
+ std::vector<int>::iterator i1(v.begin());
+ if (*i1 != 1)
+ ++failures;
+
+ ++i1;
+ if (*i1 != 2)
+ ++failures;
+
+ if (*i1++ != 2)
+ ++failures;
+ if (*i1 != 3)
+ ++failures;
+
+ ++ ++i1;
+ if (*i1 != 5)
+ ++failures;
+
+ --i1;
+ if (*i1 != 4)
+ ++failures;
+
+ if (*i1-- != 4)
+ ++failures;
+ if (*i1 != 3)
+ ++failures;
+
+ -- --i1;
+ if (*i1 != 1)
+ ++failures;
+
+ std::vector<int>::iterator i2;
+ i2 = v.end();
+ std::iterator_traits<std::vector<int>::iterator>::difference_type d1;
+ d1 = i2 - i1;
+ if (d1 != 5)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::iterator>::value_type v1;
+ v1 = i1[0];
+ if (v1 != 1)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::iterator>::reference r1(i1[0]);
+ if (r1 != 1)
+ ++failures;
+ r1 = 9;
+ if (r1 != 9)
+ ++failures;
+ r1 = 1;
+
+ if ((i1 != i2) != true)
+ ++failures;
+ if ((i1 == i2) != false)
+ ++failures;
+ if ((i1 < i2) != true)
+ ++failures;
+ if ((i1 > i2) != false)
+ ++failures;
+ if ((i1 <= i2) != true)
+ ++failures;
+ if ((i1 >= i2) != false)
+ ++failures;
+
+ std::vector<int>::iterator i3;
+ i3 = i1;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ i3 += 5;
+ if ((i3 == i2) != true)
+ ++failures;
+
+ i3 -= 5;
+ if ((i3 == i1) != true)
+ ++failures;
+
+ if (i3 + 5 != i2)
+ ++failures;
+
+ if (5 + i3 != i2)
+ ++failures;
+
+ if (i2 - 5 != i3)
+ ++failures;
+
+ if (i1[0] != 1)
+ ++failures;
+
+ i1[4] = 9;
+ if (i2[-1] != 9)
+ ++failures;
+ i1[4] = 5;
+
+ i1[2] = 9;
+ if (i2[-3] != 9)
+ ++failures;
+ i1[2] = 3;
+
+ std::vector<int>::const_iterator ci1(v.begin());
+ if (*ci1 != 1)
+ ++failures;
+
+ ++ci1;
+ if (*ci1 != 2)
+ ++failures;
+
+ if (*ci1++ != 2)
+ ++failures;
+ if (*ci1 != 3)
+ ++failures;
+
+ ++ ++ci1;
+ if (*ci1 != 5)
+ ++failures;
+
+ --ci1;
+ if (*ci1 != 4)
+ ++failures;
+
+ if (*ci1-- != 4)
+ ++failures;
+ if (*ci1 != 3)
+ ++failures;
+
+ -- --ci1;
+ if (*ci1 != 1)
+ ++failures;
+
+ std::vector<int>::const_iterator ci2;
+ ci2 = v.end();
+ std::iterator_traits<std::vector<int>::const_iterator>::difference_type d2;
+ d2 = ci2 - ci1;
+ if (d2 != 5)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::const_iterator>::value_type v2;
+ v2 = ci1[0];
+ if (v2 != 1)
+ ++failures;
+
+ std::iterator_traits<std::vector<int>::const_iterator>::reference
+ r2(ci1[0]);
+ if (r2 != 1)
+ ++failures;
+
+ if ((ci1 != ci2) != true)
+ ++failures;
+ if ((ci1 == ci2) != false)
+ ++failures;
+ if ((ci1 < ci2) != true)
+ ++failures;
+ if ((ci1 > ci2) != false)
+ ++failures;
+ if ((ci1 <= ci2) != true)
+ ++failures;
+ if ((ci1 >= ci2) != false)
+ ++failures;
+
+ std::vector<int>::const_iterator ci3;
+ ci3 = ci1;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ ci3 += 5;
+ if ((ci3 == ci2) != true)
+ ++failures;
+
+ ci3 -= 5;
+ if ((ci3 == ci1) != true)
+ ++failures;
+
+ if (ci3 + 5 != ci2)
+ ++failures;
+
+ if (5 + ci3 != ci2)
+ ++failures;
+
+ if (ci2 - 5 != ci3)
+ ++failures;
+
+ if (ci1[2] != 3)
+ ++failures;
+
+ if (ci2[-1] != 5)
+ ++failures;
+
+ // iterator to const_iterator
+ std::vector<int>::const_iterator ci4(i1);
+ if ((ci4 == i1) != true)
+ ++failures;
+ if ((ci4 != i1) != false)
+ ++failures;
+ if ((ci4 < i1) != false)
+ ++failures;
+ if ((ci4 > i1) != false)
+ ++failures;
+ if ((ci4 <= i1) != true)
+ ++failures;
+ if ((ci4 >= i1) != true)
+ ++failures;
+ ci4 = i2;
+ if ((i2 == ci4) != true)
+ ++failures;
+ if ((i2 < ci4) != false)
+ ++failures;
+ if ((i2 > ci4) != false)
+ ++failures;
+ if ((i2 <= ci4) != true)
+ ++failures;
+ if ((i2 >= ci4) != true)
+ ++failures;
+
+ const std::vector<int> cv(v);
+ std::vector<int>::const_iterator ci5(cv.begin());
+ if (ci5[0] != 1)
+ ++failures;
+
+ std::vector<std::string> vs;
+ vs.push_back(std::string("abc"));
+ std::vector<std::string>::iterator ivs(vs.begin());
+ if (ivs->c_str()[1] != 'b')
+ ++failures;
+
+ return failures;
+}
+
+int
+reverse_stuff()
+{
+ int failures(0);
+
+ std::string s("abcde");
+
+ std::string::reverse_iterator ri(s.rbegin());
+ if (*ri != 'e')
+ ++failures;
+
+ std::iterator_traits<std::string::reverse_iterator>::difference_type d;
+ d = s.rend() - ri;
+ if (d != 5)
+ ++failures;
+
+ const std::string cs("abcde");
+ std::string::const_reverse_iterator cri(cs.rend());
+ if (cri - 5 != cs.rbegin())
+ ++failures;
+
+ return failures;
+}
+
+// the following should be compiler errors
+// flag runtime errors in case they slip through the compiler
+int
+wrong_stuff()
+{
+ int failures(0);
+
+#ifdef ITER24_F1
+ extern void f(std::vector<std::string*>::iterator);
+ std::vector<std::string*> vs[2];
+ f(vs); // address of array is not an iterator
+ failures++;
+#endif
+
+#ifdef ITER24_F2
+ std::string s;
+ char *i = s.begin(); // begin() doesn't return a pointer
+ failures++;
+#endif
+
+#ifdef ITER24_F3
+ std::string::const_iterator ci;
+ std::string::iterator i;
+ if (i - ci) // remove const_ is a warning
+ i++;
+ // failures++; only a warning
+#endif
+
+#ifdef ITER24_F4
+ std::vector<char>::iterator iv;
+ std::string::iterator is(iv);// vector<char> is not string
+ failures++;
+#endif
+
+#ifdef ITER24_F5
+ std::vector<char>::iterator iv;
+ std::string::iterator is;
+ if (iv == is) // vector<char> is not string
+ ++iv;
+ failures++;
+#endif
+
+#ifdef ITER24_F6
+ std::vector<char>::const_iterator ci;
+ std::vector<char>::iterator i = ci; // remove const_ is a warning
+ ++i;
+ // failures++; only a warning
+#endif
+
+#ifdef ITER24_F7
+ std::vector<int> v(1);
+ std::vector<int>::const_iterator ci(v.begin());
+ *ci = 1; // cannot assign through const_iterator
+ failures++;
+#endif
+
+#ifdef ITER24_F8
+ std::vector<const int> v(1);
+ std::vector<const int>::reference r(v.begin()[0]);
+ r = 1; // cannot assign through reference to const
+ failures++;
+#endif
+
+ return failures;
+}
+
+// libstdc++/6642
+int
+test6642()
+{
+ std::string s;
+ std::string::iterator it = s.begin();
+ std::string::const_iterator cit = s.begin();
+
+ return it - cit;
+}
+
+int
+main()
+{
+ int failures(0);
+
+ failures += string_stuff();
+
+ failures += vector_stuff();
+
+ failures += reverse_stuff();
+
+ failures += wrong_stuff();
+
+ failures += test6642();
+
+ VERIFY(failures == 0);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/range_access.cc b/libstdc++-v3/testsuite/24_iterators/range_access.cc
new file mode 100644
index 000000000..e2e37e34c
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/range_access.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <iterator>
+
+void
+test01()
+{
+ int arr[3] = {1, 2, 3};
+ std::begin(arr);
+ std::end(arr);
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/11729.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/11729.cc
new file mode 100644
index 000000000..6180da7a2
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/11729.cc
@@ -0,0 +1,72 @@
+// 2005-10-04 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/>.
+
+// 24.4.1.2 Reverse iterators
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/11729
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<int> Vec;
+ typedef Vec::reverse_iterator reverse_iterator;
+ typedef Vec::const_reverse_iterator const_reverse_iterator;
+
+ Vec v(2);
+
+ reverse_iterator rbeg = v.rbegin();
+ reverse_iterator rend = v.rend();
+ const_reverse_iterator constrbeg(rbeg);
+ const_reverse_iterator constrend(rend);
+
+ VERIFY( rbeg == constrbeg );
+ VERIFY( constrend == rend );
+
+ VERIFY( rbeg != constrend );
+ VERIFY( constrbeg != rend );
+
+ VERIFY( rbeg < constrend );
+ VERIFY( constrbeg < rend );
+
+ VERIFY( rend > constrbeg );
+ VERIFY( constrend > rbeg );
+
+ VERIFY( rend >= constrend );
+ VERIFY( constrbeg >= rbeg );
+
+ VERIFY( rbeg <= constrbeg );
+ VERIFY( constrend <= rend );
+
+ VERIFY( rbeg - constrbeg == 0 );
+ VERIFY( constrend - rend == 0 );
+
+ VERIFY( rend - constrbeg > 0 );
+ VERIFY( constrend - rbeg > 0 );
+
+ VERIFY( (constrbeg = rend) == rend );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/2.cc
new file mode 100644
index 000000000..945b57aa4
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/2.cc
@@ -0,0 +1,45 @@
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 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/>.
+
+// 24.4.1.2 Reverse iterators
+
+#include <iterator>
+
+void test02()
+{
+ typedef std::reverse_iterator<int*> iterator_type;
+ iterator_type it01;
+ iterator_type it02;
+
+ // Sanity check non-member operators and functions can be instantiated.
+ it01 == it02;
+ it01 != it02;
+ it01 < it02;
+ it01 <= it02;
+ it01 > it02;
+ it01 >= it02;
+ it01 - it02;
+ 5 + it02;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/3.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/3.cc
new file mode 100644
index 000000000..2f58f27ce
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/3.cc
@@ -0,0 +1,39 @@
+// 2003-05-29 Paolo Carlini <pcarlini@unitus.it>
+
+// 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/>.
+
+// 24.4.1.2 Reverse iterators
+
+#include <iterator>
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/10783
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::vector<int> V;
+ VERIFY( sizeof(V::iterator) == sizeof(V::reverse_iterator) );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/greedy_ops.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/greedy_ops.cc
new file mode 100644
index 000000000..3c7c46fde
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/greedy_ops.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+#include <testsuite_greedy_ops.h>
+
+void test01()
+{
+ typedef std::reverse_iterator<greedy_ops::X*> iterator_type;
+
+ iterator_type it;
+
+ it == it;
+ it != it;
+ it < it;
+ it <= it;
+ it > it;
+ it >= it;
+ it - it;
+ 1 + it;
+ it + 1;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/base_classes.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/base_classes.cc
new file mode 100644
index 000000000..71d4297b7
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/base_classes.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 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/>.
+
+// 24.4.1.2 Reverse iterators
+
+#include <iterator>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ long l;
+ typedef reverse_iterator<long*> test_iterator;
+ typedef iterator<iterator_traits<long*>::iterator_category,
+ iterator_traits<long*>::value_type,
+ iterator_traits<long*>::difference_type,
+ iterator_traits<long*>::pointer,
+ iterator_traits<long*>::reference>
+ base_iterator;
+ test_iterator r_it(&l);
+ base_iterator* base __attribute__((unused)) = &r_it;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/current.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/current.cc
new file mode 100644
index 000000000..cad21e39e
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/current.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 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/>.
+
+// 24.4.1.2 Reverse iterators
+
+#include <iterator>
+
+// Check data member 'current' accessible.
+class test_dm : public std::reverse_iterator<int*>
+{
+ int* p;
+public:
+ test_dm(): p(current) { }
+};
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..fd6dfd249
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/explicit_instantiation.cc
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 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/>.
+
+// 24.4.1.2 Reverse iterators
+
+#include <iterator>
+
+// Make sure iterator can be instantiated.
+template class std::reverse_iterator<int*>;
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/typedefs.cc
new file mode 100644
index 000000000..19e1637f8
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/requirements/typedefs.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// 2001-06-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 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/>.
+
+// 24.4.1.2 Reverse iterators
+
+#include <iterator>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required typedefs
+ typedef reverse_iterator<long*> test_iterator;
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+}