This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Ensure <experimental/iterator> includes <iterator>
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Cc: Lars Gullik Bjønnes <larsbj at gullik dot org>
- Date: Thu, 23 Feb 2017 18:25:29 +0000
- Subject: [PATCH] Ensure <experimental/iterator> includes <iterator>
- Authentication-results: sourceware.org; auth=none
Lars noticed that <experimental/iterator> didn't include <iterator> as
it's supposed to. I checked the other TS headers and they're OK.
* include/experimental/iterator: Include <iterator>.
* testsuite/experimental/iterator/requirements.cc: Check for contents
of <iterator>.
Tested powerpc64le-linux, committed to trunk.
commit 42ee67b0131274b1c3405d6cab1d83d38dc17c55
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Feb 23 17:48:27 2017 +0000
Ensure <experimental/iterator> includes <iterator>
* include/experimental/iterator: Include <iterator>.
* testsuite/experimental/iterator/requirements.cc: Check for contents
of <iterator>.
diff --git a/libstdc++-v3/include/experimental/iterator b/libstdc++-v3/include/experimental/iterator
index e8ecb34..8a8395d 100644
--- a/libstdc++-v3/include/experimental/iterator
+++ b/libstdc++-v3/include/experimental/iterator
@@ -39,10 +39,9 @@
# include <bits/c++14_warning.h>
#else
-#include <experimental/type_traits>
+#include <iterator>
#include <iosfwd>
-#include <bits/move.h>
-#include <bits/stl_iterator_base_types.h>
+#include <experimental/type_traits>
namespace std _GLIBCXX_VISIBILITY(default)
{
diff --git a/libstdc++-v3/testsuite/experimental/iterator/requirements.cc b/libstdc++-v3/testsuite/experimental/iterator/requirements.cc
index 8a8e79e..5fa5872 100644
--- a/libstdc++-v3/testsuite/experimental/iterator/requirements.cc
+++ b/libstdc++-v3/testsuite/experimental/iterator/requirements.cc
@@ -19,7 +19,7 @@
// This is a compile-only test with minimal includes
#include <experimental/iterator>
-#include <iosfwd>
+#include <iosfwd> // No guarantee that <experimental/iterator> includes this!
using namespace std::experimental;
@@ -55,3 +55,13 @@ tester<int, char> ic;
tester<wchar_t, wchar_t> ww;
tester<int, wchar_t> iw;
#endif
+
+std::ostream& os();
+
+// Ensure that contents of <iterator> are defined by <experimental/iterator>:
+std::reverse_iterator<int*> ii;
+std::move_iterator<int*> mi;
+std::istream_iterator<int> isi;
+std::ostream_iterator<int> osi(os());
+std::istreambuf_iterator<char> isbi;
+std::ostreambuf_iterator<char> osbi(os());