forked from OSchip/llvm-project
[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). Differential Revision: https://reviews.llvm.org/D122184
This commit is contained in:
parent
8907302f88
commit
6a7f055117
|
@ -610,7 +610,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_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
|
||||
|
|
|
@ -85,7 +85,6 @@ void test_std_array() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef TEST_HAS_NO_INCOMPLETE_RANGES
|
||||
void test_range_std_container() {
|
||||
{
|
||||
std::string str{"ABCDE"};
|
||||
|
@ -103,17 +102,13 @@ void test_range_std_container() {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -389,10 +389,6 @@ inline void DoNotOptimize(Tp const& value) {
|
|||
# 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")
|
||||
|
|
Loading…
Reference in New Issue