diff --git a/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp b/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp --- a/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp +++ b/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp @@ -31,57 +31,63 @@ #include #include #include +#include #include -#include #include "test_macros.h" -// std::array is explicitly allowed to be initialized with A a = { init-list };. -// Disable the missing braces warning for this reason. -#include "disable_missing_braces_warning.h" - int main(int, char**) { { int arr[] = {1,2,3}; std::span s{arr}; - using S = decltype(s); - ASSERT_SAME_TYPE(S, std::span); - assert((std::equal(std::begin(arr), std::end(arr), s.begin(), s.end()))); + ASSERT_SAME_TYPE(decltype(s), std::span); + assert(std::to_address(s.begin()) == std::begin(arr)); + assert(std::to_address(s.end()) == std::end(arr)); + } + + { + const int arr[] = {1,2,3}; + std::span s{arr}; + ASSERT_SAME_TYPE(decltype(s), std::span); + assert(std::to_address(s.begin()) == std::begin(arr)); + assert(std::to_address(s.end()) == std::end(arr)); } { std::array arr = {1.0, 2.0, 3.0, 4.0}; std::span s{arr}; - using S = decltype(s); - ASSERT_SAME_TYPE(S, std::span); - assert((std::equal(std::begin(arr), std::end(arr), s.begin(), s.end()))); + ASSERT_SAME_TYPE(decltype(s), std::span); + assert(std::to_address(s.begin()) == arr.begin()); + assert(std::to_address(s.end()) == arr.end()); } { const std::array arr = {4, 5, 6, 7, 8}; std::span s{arr}; - using S = decltype(s); - ASSERT_SAME_TYPE(S, std::span); - assert((std::equal(std::begin(arr), std::end(arr), s.begin(), s.end()))); + ASSERT_SAME_TYPE(decltype(s), std::span); + assert(std::to_address(s.begin()) == arr.begin()); + assert(std::to_address(s.end()) == arr.end()); } { std::string str{"ABCDE"}; std::span s{str}; - using S = decltype(s); - ASSERT_SAME_TYPE(S, std::span); - assert((size_t)s.size() == str.size()); - assert((std::equal(s.begin(), s.end(), std::begin(s), std::end(s)))); + ASSERT_SAME_TYPE(decltype(s), std::span); + assert(s.size() == str.size()); + assert(std::to_address(s.begin()) == std::to_address(str.begin())); + //assert(std::to_address(s.end()) == std::to_address(str.end())); // FIXME: hits assert with debug iterators for str.end() in __iterator/wrap_iter.h + assert((std::equal(s.begin(), s.end(), str.begin(), str.end()))); } { const std::string str{"QWERTYUIOP"}; std::span s{str}; - using S = decltype(s); - ASSERT_SAME_TYPE(S, std::span); - assert((size_t)s.size() == str.size()); - assert((std::equal(s.begin(), s.end(), std::begin(s), std::end(s)))); + ASSERT_SAME_TYPE(decltype(s), std::span); + assert(s.size() == str.size()); + assert(std::to_address(s.begin()) == std::to_address(str.begin())); + //assert(std::to_address(s.end()) == std::to_address(str.end())); // FIXME: hits assert with debug iterators for str.end() in __iterator/wrap_iter.h + assert((std::equal(s.begin(), s.end(), str.begin(), str.end()))); } return 0;