[libcxx-commits] [PATCH] D122201: [libc++] Re-enable workaround for pre-ranges CTAD in std::span

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 21 19:02:23 PDT 2022


ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

See https://reviews.llvm.org/D121626 for details -- this re-enables the
CTAD we removed, since it does break some stuff as well (even though it's
not nearly as bad as the removed constructors fixed by D121626 <https://reviews.llvm.org/D121626>).

(cherry picked from commit 6a7f0551178e966a686dd48dfa2ea045a35addef <https://reviews.llvm.org/rG6a7f0551178e966a686dd48dfa2ea045a35addef>)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122201

Files:
  libcxx/include/span
  libcxx/test/std/containers/views/span.cons/deduct.pass.cpp


Index: libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
===================================================================
--- libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
+++ libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// UNSUPPORTED: libcpp-no-concepts
 
 // <span>
 
@@ -86,7 +85,6 @@
     }
 }
 
-#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES
 void test_range_std_container() {
     {
     std::string str{"ABCDE"};
@@ -104,17 +102,13 @@
     assert(s.data() == str.data());
     }
 }
-#endif // _LIBCPP_HAS_NO_INCOMPLETE_RANGES
 
 int main(int, char**)
 {
   test_iterator_sentinel();
   test_c_array();
   test_std_array();
-
-#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES
   test_range_std_container();
-#endif // _LIBCPP_HAS_NO_INCOMPLETE_RANGES
 
   return 0;
 }
Index: libcxx/include/span
===================================================================
--- libcxx/include/span
+++ libcxx/include/span
@@ -622,7 +622,13 @@
 template<class _Tp, size_t _Sz>
     span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
 
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+#if defined(_LIBCPP_HAS_NO_CONCEPTS) || defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+template<class _Container>
+    span(_Container&) -> span<typename _Container::value_type>;
+
+template<class _Container>
+    span(const _Container&) -> span<const typename _Container::value_type>;
+#else
 template<ranges::contiguous_range _Range>
     span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122201.417159.patch
Type: text/x-patch
Size: 1717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220322/1f318e55/attachment.bin>


More information about the libcxx-commits mailing list