summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2019-02-27 00:32:16 +0000
committerMarshall Clow <mclow.lists@gmail.com>2019-02-27 00:32:16 +0000
commit7ad06a9319fdd54a890f75026049e3e4bcfa061e (patch)
treecc3d9f2bb97e3452e592e19441c9e6c13bdf07fb /libcxx/test/std
parent129826cd9fb5a86ad1d92eeb1b933a2c82e2721f (diff)
downloadbcm5719-llvm-7ad06a9319fdd54a890f75026049e3e4bcfa061e.tar.gz
bcm5719-llvm-7ad06a9319fdd54a890f75026049e3e4bcfa061e.zip
First part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639.
llvm-svn: 354936
Diffstat (limited to 'libcxx/test/std')
-rw-r--r--libcxx/test/std/containers/views/span.cons/default.fail.cpp2
-rw-r--r--libcxx/test/std/containers/views/span.iterators/end.pass.cpp8
-rw-r--r--libcxx/test/std/containers/views/span.iterators/rend.pass.cpp8
-rw-r--r--libcxx/test/std/containers/views/span.obs/size.pass.cpp4
-rw-r--r--libcxx/test/std/containers/views/types.pass.cpp14
5 files changed, 18 insertions, 18 deletions
diff --git a/libcxx/test/std/containers/views/span.cons/default.fail.cpp b/libcxx/test/std/containers/views/span.cons/default.fail.cpp
index 24ff77477bd..87a6e7511b7 100644
--- a/libcxx/test/std/containers/views/span.cons/default.fail.cpp
+++ b/libcxx/test/std/containers/views/span.cons/default.fail.cpp
@@ -24,7 +24,7 @@
int main(int, char**)
{
- std::span<int, 2> s; // expected-error-re@span:* {{static_assert failed{{( due to requirement '2[LL]{0,2} == 0')?}} "Can't default construct a statically sized span with size > 0"}}
+ std::span<int, 2> s; // expected-error-re@span:* {{static_assert failed{{( due to requirement '.*')?}} "Can't default construct a statically sized span with size > 0"}}
// TODO: This is what I want:
// eXpected-error {{no matching constructor for initialization of 'std::span<int, 2>'}}
diff --git a/libcxx/test/std/containers/views/span.iterators/end.pass.cpp b/libcxx/test/std/containers/views/span.iterators/end.pass.cpp
index c52c8bc6004..707ec88a424 100644
--- a/libcxx/test/std/containers/views/span.iterators/end.pass.cpp
+++ b/libcxx/test/std/containers/views/span.iterators/end.pass.cpp
@@ -38,8 +38,8 @@ constexpr bool testConstexprSpan(Span s)
ret = ret && (&*(ce-1) == last);
}
- ret = ret && (( e - s.begin()) == s.size());
- ret = ret && ((ce - s.cbegin()) == s.size());
+ ret = ret && (static_cast<size_t>( e - s.begin()) == s.size());
+ ret = ret && (static_cast<size_t>(ce - s.cbegin()) == s.size());
ret = ret && (e == ce);
return ret;
@@ -64,8 +64,8 @@ void testRuntimeSpan(Span s)
assert( &*(ce-1) == last);
}
- assert(( e - s.begin()) == s.size());
- assert((ce - s.cbegin()) == s.size());
+ assert(static_cast<size_t>( e - s.begin()) == s.size());
+ assert(static_cast<size_t>(ce - s.cbegin()) == s.size());
assert(e == ce);
}
diff --git a/libcxx/test/std/containers/views/span.iterators/rend.pass.cpp b/libcxx/test/std/containers/views/span.iterators/rend.pass.cpp
index 056fe2a7d2b..23d09d5bf93 100644
--- a/libcxx/test/std/containers/views/span.iterators/rend.pass.cpp
+++ b/libcxx/test/std/containers/views/span.iterators/rend.pass.cpp
@@ -35,8 +35,8 @@ constexpr bool testConstexprSpan(Span s)
ret = ret && (ce != s.crbegin());
}
- ret = ret && (( e - s.rbegin()) == s.size());
- ret = ret && ((ce - s.crbegin()) == s.size());
+ ret = ret && (static_cast<size_t>( e - s.rbegin()) == s.size());
+ ret = ret && (static_cast<size_t>(ce - s.crbegin()) == s.size());
ret = ret && (e == ce);
return ret;
@@ -58,8 +58,8 @@ void testRuntimeSpan(Span s)
assert(ce != s.crbegin());
}
- assert(( e - s.rbegin()) == s.size());
- assert((ce - s.crbegin()) == s.size());
+ assert(static_cast<size_t>( e - s.rbegin()) == s.size());
+ assert(static_cast<size_t>(ce - s.crbegin()) == s.size());
assert(e == ce);
}
diff --git a/libcxx/test/std/containers/views/span.obs/size.pass.cpp b/libcxx/test/std/containers/views/span.obs/size.pass.cpp
index f1dbc1fd99e..b5dcefd8d7d 100644
--- a/libcxx/test/std/containers/views/span.obs/size.pass.cpp
+++ b/libcxx/test/std/containers/views/span.obs/size.pass.cpp
@@ -22,7 +22,7 @@
template <typename Span>
-constexpr bool testConstexprSpan(Span sp, ptrdiff_t sz)
+constexpr bool testConstexprSpan(Span sp, size_t sz)
{
ASSERT_NOEXCEPT(sp.size());
return sp.size() == sz;
@@ -30,7 +30,7 @@ constexpr bool testConstexprSpan(Span sp, ptrdiff_t sz)
template <typename Span>
-void testRuntimeSpan(Span sp, ptrdiff_t sz)
+void testRuntimeSpan(Span sp, size_t sz)
{
ASSERT_NOEXCEPT(sp.size());
assert(sp.size() == sz);
diff --git a/libcxx/test/std/containers/views/types.pass.cpp b/libcxx/test/std/containers/views/types.pass.cpp
index 22eae24f4b1..60c365b8938 100644
--- a/libcxx/test/std/containers/views/types.pass.cpp
+++ b/libcxx/test/std/containers/views/types.pass.cpp
@@ -16,7 +16,7 @@
// // constants and types
// using element_type = ElementType;
// using value_type = remove_cv_t<ElementType>;
-// using index_type = ptrdiff_t;
+// using index_type = size_t;
// using difference_type = ptrdiff_t;
// using pointer = element_type *;
// using reference = element_type &;
@@ -63,12 +63,12 @@ void testConstIterator()
ASSERT_SAME_TYPE(typename ItT::difference_type, typename S::difference_type);
}
-template <typename S, typename ElementType, std::ptrdiff_t Size>
+template <typename S, typename ElementType, std::size_t Size>
void testSpan()
{
ASSERT_SAME_TYPE(typename S::element_type, ElementType);
ASSERT_SAME_TYPE(typename S::value_type, std::remove_cv_t<ElementType>);
- ASSERT_SAME_TYPE(typename S::index_type, std::ptrdiff_t);
+ ASSERT_SAME_TYPE(typename S::index_type, std::size_t);
ASSERT_SAME_TYPE(typename S::difference_type, std::ptrdiff_t);
ASSERT_SAME_TYPE(typename S::pointer, ElementType *);
ASSERT_SAME_TYPE(typename S::const_pointer, const ElementType *);
@@ -87,10 +87,10 @@ void testSpan()
template <typename T>
void test()
{
- testSpan<std::span< T>, T, -1>();
- testSpan<std::span<const T>, const T, -1>();
- testSpan<std::span< volatile T>, volatile T, -1>();
- testSpan<std::span<const volatile T>, const volatile T, -1>();
+ testSpan<std::span< T>, T, std::dynamic_extent>();
+ testSpan<std::span<const T>, const T, std::dynamic_extent>();
+ testSpan<std::span< volatile T>, volatile T, std::dynamic_extent>();
+ testSpan<std::span<const volatile T>, const volatile T, std::dynamic_extent>();
testSpan<std::span< T, 5>, T, 5>();
testSpan<std::span<const T, 5>, const T, 5>();
OpenPOWER on IntegriCloud