llvm-toolchain/debian/patches/0002-libc-Re-enable-workaround-for-pre-ranges-CTAD-in-std.patch
Sedat Dilek bb04d66687 Add libc++ patches from upstream (post version 14.0.0)
Details see Debian bug #1008657
("clang-14: Integrate post v14.0.0 upstream patches")

Link: https://bugs.debian.org/1008657
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
2022-03-30 18:30:59 +02:00

79 lines
2.6 KiB
Diff

From 3f43d803382d57e3fc010ca19833077d1023e9c9 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2@gmail.com>
Date: Mon, 21 Mar 2022 17:05:06 -0400
Subject: [PATCH] [libc++] Re-enable workaround for pre-ranges CTAD in
std::span
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).
(cherry picked from commit 6a7f0551178e966a686dd48dfa2ea045a35addef)
Differential Revision: https://reviews.llvm.org/D122201
---
libcxx/include/span | 8 +++++++-
.../test/std/containers/views/span.cons/deduct.pass.cpp | 6 ------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/libcxx/include/span b/libcxx/include/span
index b8dbc7e01fd6..f33569031730 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -622,7 +622,13 @@ template<class _Tp, size_t _Sz>
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
diff --git a/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp b/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
index 81632fed711d..e632feca2e1f 100644
--- a/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
+++ b/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 @@ void test_std_array() {
}
}
-#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES
void test_range_std_container() {
{
std::string str{"ABCDE"};
@@ -104,17 +102,13 @@ void test_range_std_container() {
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;
}
--
2.35.1