Skip to content

Commit 2601e34

Browse files
Missing inclusion and test skipping
1 parent 9c2f7ca commit 2601e34

File tree

6 files changed

+52
-23
lines changed

6 files changed

+52
-23
lines changed

libcxx/include/__iterator/const_iterator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <__compare/three_way_comparable.h>
1414
#include <__concepts/common_with.h>
15+
#include <__concepts/constructible.h>
1516
#include <__concepts/convertible_to.h>
1617
#include <__concepts/different_from.h>
1718
#include <__concepts/same_as.h>
@@ -29,6 +30,7 @@
2930
#include <__type_traits/integral_constant.h>
3031
#include <__type_traits/is_reference.h>
3132
#include <__type_traits/is_specialization.h>
33+
#include <__type_traits/remove_cvref.h>
3234
#include <__utility/forward.h>
3335
#include <__utility/move.h>
3436

libcxx/include/__ranges/access.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <__memory/pointer_traits.h>
1919
#include <__ranges/enable_borrowed_range.h>
2020
#include <__type_traits/decay.h>
21+
#include <__type_traits/is_object.h>
2122
#include <__type_traits/is_pointer.h>
2223
#include <__type_traits/is_reference.h>
2324
#include <__type_traits/remove_cvref.h>

libcxx/include/__ranges/as_const_view.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@
2020
#include <__ranges/ref_view.h>
2121
#include <__ranges/size.h>
2222
#include <__ranges/view_interface.h>
23+
#include <__type_traits/is_reference.h>
2324
#include <__type_traits/is_specialization.h>
2425
#include <__utility/auto_cast.h>
26+
#include <__utility/declval.h>
27+
#include <__utility/forward.h>
2528
#include <__utility/move.h>
2629
#include <__utility/pair.h>
2730
#include <cstddef>

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,17 @@ constexpr bool test_all() {
8787
test<volatile double>();
8888
test<const volatile double>();
8989

90-
// Note: Can't test non-fundamental types with volatile because we require `T*` to be indirectly_readable,
91-
// which isn't the case when T is volatile.
90+
// Note: Can't test class types with volatile because we require `T*` to be indirectly_readable,
91+
// which isn't the case when T is volatile. See also LWG3813.
9292
test<Foo>();
9393
test<const Foo>();
9494

9595
test<std::string>();
9696
test<const std::string>();
9797

98+
#if defined(_LIBCPP_VERSION) && TEST_STD_VER < 23
99+
// libc++ supports span<Incomplete> as an extension in C++20 mode,
100+
// but the extension is incompatible with changes of span in C++23.
98101
// Regression test for https://github.com/llvm/llvm-project/issues/104496
99102
{
100103
struct Incomplete;
@@ -103,6 +106,7 @@ constexpr bool test_all() {
103106
assert(copy.data() == x.data());
104107
assert(copy.size() == x.size());
105108
}
109+
#endif
106110

107111
return true;
108112
}

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,16 @@ TEST_CONSTEXPR_CXX20 void check() {
8787
}
8888

8989
template <class T>
90-
TEST_CONSTEXPR_CXX20 void check_cvs() {
90+
constexpr void check_non_volatile() {
9191
check<T, T>();
9292

9393
check<T const, T>();
9494
check<T const, T const>();
95+
}
96+
97+
template <class T>
98+
constexpr void check_cvs() {
99+
check_non_volatile<T>();
95100

96101
check<T volatile, T>();
97102
check<T volatile, T volatile>();
@@ -104,12 +109,17 @@ TEST_CONSTEXPR_CXX20 void check_cvs() {
104109

105110
struct A {};
106111

107-
TEST_CONSTEXPR_CXX20 bool test() {
112+
constexpr bool test() {
108113
check_cvs<int>();
109114
check_cvs<long>();
110115
check_cvs<double>();
116+
#if TEST_STD_VER >= 23 // LWG3813: span<volatile class> is generally unsupported since C++23.
117+
check_non_volatile<std::string>();
118+
check_non_volatile<A>();
119+
#else
111120
check_cvs<std::string>();
112121
check_cvs<A>();
122+
#endif
113123
return true;
114124
}
115125

libcxx/test/std/containers/views/views.span/types.pass.cpp

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,30 +66,39 @@ void testSpan()
6666
testIterator<S, typename S::reverse_iterator>();
6767
}
6868

69+
template <typename T>
70+
void test_non_volatile() {
71+
testSpan<std::span<T>, T, std::dynamic_extent>();
72+
testSpan<std::span<const T>, const T, std::dynamic_extent>();
73+
74+
testSpan<std::span<T, 5>, T, 5>();
75+
testSpan<std::span<const T, 5>, const T, 5>();
76+
}
6977

7078
template <typename T>
71-
void test()
72-
{
73-
testSpan<std::span< T>, T, std::dynamic_extent>();
74-
testSpan<std::span<const T>, const T, std::dynamic_extent>();
75-
testSpan<std::span< volatile T>, volatile T, std::dynamic_extent>();
76-
testSpan<std::span<const volatile T>, const volatile T, std::dynamic_extent>();
77-
78-
testSpan<std::span< T, 5>, T, 5>();
79-
testSpan<std::span<const T, 5>, const T, 5>();
80-
testSpan<std::span< volatile T, 5>, volatile T, 5>();
81-
testSpan<std::span<const volatile T, 5>, const volatile T, 5>();
79+
void test() {
80+
test_non_volatile<T>();
81+
82+
testSpan<std::span<volatile T>, volatile T, std::dynamic_extent>();
83+
testSpan<std::span<const volatile T>, const volatile T, std::dynamic_extent>();
84+
85+
testSpan<std::span<volatile T, 5>, volatile T, 5>();
86+
testSpan<std::span<const volatile T, 5>, const volatile T, 5>();
8287
}
8388

84-
struct A{};
89+
struct A {};
8590

86-
int main(int, char**)
87-
{
88-
test<int>();
89-
test<long>();
90-
test<double>();
91-
test<std::string>();
92-
test<A>();
91+
int main(int, char**) {
92+
test<int>();
93+
test<long>();
94+
test<double>();
95+
#if TEST_STD_VER >= 23 // LWG3813: span<volatile class> is generally unsupported since C++23.
96+
test_non_volatile<std::string>();
97+
test_non_volatile<A>();
98+
#else
99+
test<std::string>();
100+
test<A>();
101+
#endif
93102

94103
return 0;
95104
}

0 commit comments

Comments
 (0)