libstdc++: LWG 3397 basic_istream_view::iterator should not provide iterator_category
authorPatrick Palka <ppalka@redhat.com>
Mon, 24 Feb 2020 22:13:40 +0000 (17:13 -0500)
committerPatrick Palka <ppalka@redhat.com>
Tue, 25 Feb 2020 18:04:33 +0000 (13:04 -0500)
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.

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/std/ranges/istream_view.cc

index 66c319d598c845bf0bfb5d650c49bb7b93da72c1..071ba3a2a0460aeab9f259e8d9b05e23efeeba0d 100644 (file)
@@ -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
index 442d1d08098e73d44f9df495c863f246f48f16d3..a7f4da957ef1d720710149ee6d6bf98d401684b4 100644 (file)
@@ -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;
 
index 1729459bce3eacdebfd10f6b697f5169d753bc57..f74e05e347a9b2bbdab10f111b801322d1340a11 100644 (file)
@@ -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();
 }