[libc++] Addresses LWG3103.
authorMark de Wever <koraq@xs4all.nl>
Mon, 6 Feb 2023 20:43:35 +0000 (21:43 +0100)
committerMark de Wever <koraq@xs4all.nl>
Sat, 4 Mar 2023 12:24:44 +0000 (13:24 +0100)
  LWG3103 Errors in taking subview of span should be ill-formed where possible

Note that the real work was already done before, including tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D143432

libcxx/docs/Status/Cxx20Issues.csv
libcxx/test/std/containers/views/views.span/span.sub/first.pass.cpp
libcxx/test/std/containers/views/views.span/span.sub/first.verify.cpp
libcxx/test/std/containers/views/views.span/span.sub/last.pass.cpp
libcxx/test/std/containers/views/views.span/span.sub/last.verify.cpp
libcxx/test/std/containers/views/views.span/span.sub/subspan.pass.cpp
libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp

index 0b03c35..c2cee7e 100644 (file)
 "`3266 <https://wg21.link/LWG3266>`__","``to_chars(bool)``\  should be deleted","Belfast","|Complete|","14.0"
 "`3272 <https://wg21.link/LWG3272>`__","``%I%p``\  should parse/format ``duration``\  since midnight","Belfast","","","|chrono| |format|"
 "`3259 <https://wg21.link/LWG3259>`__","The definition of *constexpr iterators* should be adjusted","Belfast","|Nothing To Do|",""
-"`3103 <https://wg21.link/LWG3103>`__","Errors in taking subview of ``span``\  should be ill-formed where possible","Belfast","",""
+"`3103 <https://wg21.link/LWG3103>`__","Errors in taking subview of ``span``\  should be ill-formed where possible","Belfast","11.0","|Complete|"
 "`3274 <https://wg21.link/LWG3274>`__","Missing feature test macro for ``<span>``\ ","Belfast","|Complete|","11.0"
 "`3276 <https://wg21.link/LWG3276>`__","Class ``split_view::outer_iterator::value_type``\  should inherit from ``view_interface``\ ","Belfast","|Complete|","15.0","|ranges|"
 "`3277 <https://wg21.link/LWG3277>`__","Pre-increment on prvalues is not a requirement of ``weakly_incrementable``\ ","Belfast","|Nothing To Do|","","|ranges|"
index 2b04cb0..37baea2 100644 (file)
@@ -14,8 +14,7 @@
 //
 // constexpr span<element_type, dynamic_extent> first(size_type count) const;
 //
-//  Requires: Count <= size().
-
+// Mandates: Count <= Extent is true.
 
 #include <span>
 #include <cassert>
index 8e011b5..39d04b0 100644 (file)
@@ -12,7 +12,7 @@
 // template<size_t Count>
 //  constexpr span<element_type, Count> first() const;
 //
-//  Requires: Count <= size().
+// Mandates: Count <= Extent is true.
 
 #include <span>
 #include <cstddef>
index 6fa6edf..1cddaa1 100644 (file)
@@ -14,8 +14,7 @@
 //
 // constexpr span<element_type, dynamic_extent> last(size_type count) const;
 //
-//  Requires: Count <= size().
-
+// Mandates: Count <= Extent is true.
 
 #include <span>
 #include <cassert>
index 1594e68..9fc6deb 100644 (file)
@@ -12,7 +12,7 @@
 // template<size_t Count>
 //  constexpr span<element_type, Count> last() const;
 //
-//  Requires: Count <= size().
+// Mandates: Count <= Extent is true.
 
 #include <span>
 #include <cstddef>
index f426ab6..bc57313 100644 (file)
@@ -15,8 +15,7 @@
 // constexpr span<element_type, dynamic_extent> subspan(
 //   size_type offset, size_type count = dynamic_extent) const;
 //
-//  Requires: (0 <= Offset && Offset <= size())
-//      && (Count == dynamic_extent || Count >= 0 && Offset + Count <= size())
+// Mandates: Offset <= Extent && (Count == dynamic_extent || Count <= Extent - Offset) is true.
 
 #include <span>
 #include <cassert>
index 1e58162..e74674e 100644 (file)
@@ -16,8 +16,7 @@
 // template<size_t Offset, size_t Count = dynamic_extent>
 //   constexpr span<element_type, see below> subspan() const;
 //
-//  Requires: offset <= size() &&
-//            (count == dynamic_extent || count <= size() - offset)
+// Mandates: Offset <= Extent && (Count == dynamic_extent || Count <= Extent - Offset) is true.
 
 #include <span>
 #include <cstddef>