public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/ranger] libstdc++: LWG 3397 basic_istream_view::iterator should not provide iterator_category
@ 2020-06-17 19:11 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2020-06-17 19:11 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:76a8c0f65e2b676bf78e44dbb5a3048f0d6e3170

commit 76a8c0f65e2b676bf78e44dbb5a3048f0d6e3170
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Feb 24 17:13:40 2020 -0500

    libstdc++: LWG 3397 basic_istream_view::iterator should not provide iterator_category
    
    libstdc++-v3/ChangeLog:
    
            LWG 3397 basic_istream_view::iterator should not provide
            iterator_category
            * include/std/ranges (basic_istream_view:_Iterator::iterator_category):
            Rename to ...
            (basic_istream_view:_Iterator::iterator_concept): ... this.
            * testsuite/std/ranges/istream_view.cc: Augment test.

Diff:
---
 libstdc++-v3/ChangeLog                            |  7 +++++++
 libstdc++-v3/include/std/ranges                   |  2 +-
 libstdc++-v3/testsuite/std/ranges/istream_view.cc | 16 ++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 66c319d598c..071ba3a2a04 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,12 @@
 2020-02-25  Patrick Palka  <ppalka@redhat.com>
 
+	LWG 3397 basic_istream_view::iterator should not provide
+	iterator_category
+	* include/std/ranges (basic_istream_view:_Iterator::iterator_category):
+	Rename to ...
+	(basic_istream_view:_Iterator::iterator_concept): ... this.
+	* testsuite/std/ranges/istream_view.cc: Augment test.
+
 	LWG 3325 Constrain return type of transformation function for
 	transform_view
 	* include/std/ranges (transform_view): Constrain the return type of the
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 442d1d08098..a7f4da957ef 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -971,7 +971,7 @@ namespace views
       struct _Iterator
       {
       public:
-	using iterator_category = input_iterator_tag;
+	using iterator_concept = input_iterator_tag;
 	using difference_type = ptrdiff_t;
 	using value_type = _Val;
 
diff --git a/libstdc++-v3/testsuite/std/ranges/istream_view.cc b/libstdc++-v3/testsuite/std/ranges/istream_view.cc
index 1729459bce3..f74e05e347a 100644
--- a/libstdc++-v3/testsuite/std/ranges/istream_view.cc
+++ b/libstdc++-v3/testsuite/std/ranges/istream_view.cc
@@ -68,10 +68,26 @@ test03()
   VERIFY( ranges::equal(v, (int[]){0,1,2,3,4}) );
 }
 
+template<typename T>
+concept has_iterator_category = requires { typename T::iterator_category; };
+
+void
+test04()
+{
+  std::istringstream s("12345");
+  auto v = ranges::istream_view<char>(s);
+  // LWG 3397
+  using It = ranges::iterator_t<decltype(v)>;
+  static_assert(!has_iterator_category<It>);
+  static_assert(std::input_iterator<It>);
+  static_assert(!std::forward_iterator<It>);
+}
+
 int
 main()
 {
   test01();
   test02();
   test03();
+  test04();
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-17 19:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 19:11 [gcc/devel/ranger] libstdc++: LWG 3397 basic_istream_view::iterator should not provide iterator_category Aldy Hernandez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).