Skip to content

Commit 3f43d80

Browse files
committed
[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 6a7f055) Differential Revision: https://reviews.llvm.org/D122201
1 parent add3ab7 commit 3f43d80

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

libcxx/include/span

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,13 @@ template<class _Tp, size_t _Sz>
622622
template<class _Tp, size_t _Sz>
623623
span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
624624

625-
#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
625+
#if defined(_LIBCPP_HAS_NO_CONCEPTS) || defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
626+
template<class _Container>
627+
span(_Container&) -> span<typename _Container::value_type>;
628+
629+
template<class _Container>
630+
span(const _Container&) -> span<const typename _Container::value_type>;
631+
#else
626632
template<ranges::contiguous_range _Range>
627633
span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
628634
#endif

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88
// UNSUPPORTED: c++03, c++11, c++14, c++17
9-
// UNSUPPORTED: libcpp-no-concepts
109

1110
// <span>
1211

@@ -86,7 +85,6 @@ void test_std_array() {
8685
}
8786
}
8887

89-
#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES
9088
void test_range_std_container() {
9189
{
9290
std::string str{"ABCDE"};
@@ -104,17 +102,13 @@ void test_range_std_container() {
104102
assert(s.data() == str.data());
105103
}
106104
}
107-
#endif // _LIBCPP_HAS_NO_INCOMPLETE_RANGES
108105

109106
int main(int, char**)
110107
{
111108
test_iterator_sentinel();
112109
test_c_array();
113110
test_std_array();
114-
115-
#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES
116111
test_range_std_container();
117-
#endif // _LIBCPP_HAS_NO_INCOMPLETE_RANGES
118112

119113
return 0;
120114
}

0 commit comments

Comments
 (0)