Cleanup some test issues:
* improve coverage in `span`'s "conversion from `std::array`" test, while eliminating MSVC diagnostics about `testConstructorArray<T>() && testConstructorArray<const T, T>()` being redundant when `T` is already `const`.
* Remove use of `is_assignable` that triggers UB due to an insufficiently-complete type argument in `std::function`'s assignment operator test.
* Don't test that `shared_ptr` initialization from an rvalue triggers the lvalue aliasing constructor on non-libc++; this is not the case for Standard Libraries that implement LWG-2996. (Ditto, I'd simply remove this but it's your library ;).)
Differential Revision: https://reviews.llvm.org/D80030
diff --git a/libcxx/test/std/containers/views/span.cons/stdarray.pass.cpp b/libcxx/test/std/containers/views/span.cons/stdarray.pass.cpp
index a598253..e6d9a9f 100644
--- a/libcxx/test/std/containers/views/span.cons/stdarray.pass.cpp
+++ b/libcxx/test/std/containers/views/span.cons/stdarray.pass.cpp
@@ -68,41 +68,43 @@
}
}
-template <typename T, typename U = T>
-constexpr bool testConstructorArray()
-{
- std::array<U,2> val = { U(), U() };
- ASSERT_NOEXCEPT(std::span<T> {val});
- ASSERT_NOEXCEPT(std::span<T, 2>{val});
- std::span<T> s1{val};
- std::span<T, 2> s2{val};
- return s1.data() == &val[0] && s1.size() == 2
- && s2.data() == &val[0] && s2.size() == 2;
+template <typename T, typename U>
+constexpr bool testConstructorArray() {
+ std::array<U, 2> val = {U(), U()};
+ ASSERT_NOEXCEPT(std::span<T>{val});
+ ASSERT_NOEXCEPT(std::span<T, 2>{val});
+ std::span<T> s1{val};
+ std::span<T, 2> s2{val};
+ return s1.data() == &val[0] && s1.size() == 2 && s2.data() == &val[0] &&
+ s2.size() == 2;
}
-template <typename T, typename U = T>
-constexpr bool testConstructorConstArray()
-{
- const std::array<U,2> val = { U(), U() };
- ASSERT_NOEXCEPT(std::span<const T> {val});
- ASSERT_NOEXCEPT(std::span<const T, 2>{val});
- std::span<const T> s1{val};
- std::span<const T, 2> s2{val};
- return s1.data() == &val[0] && s1.size() == 2
- && s2.data() == &val[0] && s2.size() == 2;
+template <typename T, typename U>
+constexpr bool testConstructorConstArray() {
+ const std::array<U, 2> val = {U(), U()};
+ ASSERT_NOEXCEPT(std::span<const T>{val});
+ ASSERT_NOEXCEPT(std::span<const T, 2>{val});
+ std::span<const T> s1{val};
+ std::span<const T, 2> s2{val};
+ return s1.data() == &val[0] && s1.size() == 2 && s2.data() == &val[0] &&
+ s2.size() == 2;
}
template <typename T>
constexpr bool testConstructors() {
- static_assert(testConstructorArray<T>(), "");
- static_assert(testConstructorArray<const T, T>(), "");
- static_assert(testConstructorConstArray<T>(), "");
- static_assert(testConstructorConstArray<const T, T>(), "");
+ static_assert(testConstructorArray<T, T>(), "");
+ static_assert(testConstructorArray<const T, const T>(), "");
+ static_assert(testConstructorArray<const T, T>(), "");
+ static_assert(testConstructorConstArray<T, T>(), "");
+ static_assert(testConstructorConstArray<const T, const T>(), "");
+ static_assert(testConstructorConstArray<const T, T>(), "");
- return testConstructorArray<T>()
- && testConstructorArray<const T, T>()
- && testConstructorConstArray<T>()
- && testConstructorConstArray<const T, T>();
+ return testConstructorArray<T, T>() &&
+ testConstructorArray<const T, const T>() &&
+ testConstructorArray<const T, T>() &&
+ testConstructorConstArray<T, T>() &&
+ testConstructorConstArray<const T, const T>() &&
+ testConstructorConstArray<const T, T>();
}
struct A{};
@@ -115,9 +117,7 @@
assert(testConstructors<A>());
assert(testConstructors<int*>());
- assert(testConstructors<int* const>());
assert(testConstructors<const int*>());
- assert(testConstructors<const int* const>());
checkCV();