libstdc++: make common_iterator<I, S> require copyable<I> (LWG 3385)
authorJonathan Wakely <jwakely@redhat.com>
Wed, 19 Feb 2020 21:56:29 +0000 (21:56 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 19 Feb 2020 22:11:27 +0000 (22:11 +0000)
* include/bits/stl_iterator.h (common_iterator): Add copyable<I>
requirement (LWG 3385).
* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc: Adjust
expected declaration.

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis_c++20.cc

index ef91b80ef45c5b0f7ca9eeb92c89fb6e832c6802..7f3f88769573dbeaf0a68fb1ca69fe3dd3970526 100644 (file)
@@ -1,5 +1,10 @@
 2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/bits/stl_iterator.h (common_iterator): Add copyable<I>
+       requirement (LWG 3385).
+       * testsuite/24_iterators/headers/iterator/synopsis_c++20.cc: Adjust
+       expected declaration.
+
        * include/std/ranges (take_while_view, drop_view, drop_while_view)
        (elements_view:_Iterator): Initialize data members (LWG 3364).
 
index fc9d442b47567c4f31b6065ace381f5771c80771..372df223113fd8d1475b79be60101c39fcfddc54 100644 (file)
@@ -1426,7 +1426,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// An iterator/sentinel adaptor for representing a non-common range.
   template<input_or_output_iterator _It, sentinel_for<_It> _Sent>
-    requires (!same_as<_It, _Sent>)
+    requires (!same_as<_It, _Sent>) && copyable<_It>
   class common_iterator
   {
     template<typename _Tp, typename _Up>
index 4d8eca31d388801917b6849f562eea323a774f76..fbe116be2fd122462e2231d173134754cee2bc10 100644 (file)
@@ -56,7 +56,7 @@ namespace std
   template<semiregular S> class move_sentinel;
 
   template<input_or_output_iterator I, sentinel_for<I> S>
-    requires (!same_as<I, S>)
+    requires (!same_as<I, S>) && copyable<I>
     class common_iterator;
 
   template<class I, class S>