[libcxx-commits] [PATCH] D122184: [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 18:56:59 PDT 2022


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6a7f0551178e: [libc++] Re-enable workaround for pre-ranges CTAD in std::span (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122184/new/

https://reviews.llvm.org/D122184

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


Index: libcxx/test/support/test_macros.h
===================================================================
--- libcxx/test/support/test_macros.h
+++ libcxx/test/support/test_macros.h
@@ -389,10 +389,6 @@
 #  define TEST_HAS_NO_FGETPOS_FSETPOS
 #endif
 
-#if defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
-#  define TEST_HAS_NO_INCOMPLETE_RANGES
-#endif
-
 #if defined(TEST_COMPILER_CLANG)
 #  define TEST_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
 #  define TEST_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
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
@@ -85,7 +85,6 @@
     }
 }
 
-#ifndef TEST_HAS_NO_INCOMPLETE_RANGES
 void test_range_std_container() {
     {
     std::string str{"ABCDE"};
@@ -103,17 +102,13 @@
     assert(s.data() == str.data());
     }
 }
-#endif // TEST_HAS_NO_INCOMPLETE_RANGES
 
 int main(int, char**)
 {
   test_iterator_sentinel();
   test_c_array();
   test_std_array();
-
-#ifndef TEST_HAS_NO_INCOMPLETE_RANGES
   test_range_std_container();
-#endif // TEST_HAS_NO_INCOMPLETE_RANGES
 
   return 0;
 }
Index: libcxx/include/span
===================================================================
--- libcxx/include/span
+++ libcxx/include/span
@@ -610,7 +610,13 @@
 template<class _Tp, size_t _Sz>
     span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+#if 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: D122184.417157.patch
Type: text/x-patch
Size: 1950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220322/4866bfd4/attachment.bin>


More information about the libcxx-commits mailing list