[PATCH] D73138: [libcxx] [test] Correct asserted type in subspan test; subspan with count should never produce dynamic_extent
Louis Dionne via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 18 12:08:37 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa7dcbe90cc2d: [libc++] Fix overly complicated test of std::span's extent (authored by ldionne).
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Changed prior to commit:
https://reviews.llvm.org/D73138?vs=239423&id=245236#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73138/new/
https://reviews.llvm.org/D73138
Files:
libcxx/test/std/containers/views/span.sub/subspan.pass.cpp
Index: libcxx/test/std/containers/views/span.sub/subspan.pass.cpp
===================================================================
--- libcxx/test/std/containers/views/span.sub/subspan.pass.cpp
+++ libcxx/test/std/containers/views/span.sub/subspan.pass.cpp
@@ -37,13 +37,7 @@
using S2 = decltype(s2);
ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- if constexpr (Count != std::dynamic_extent) {
- static_assert(S1::extent == Count);
- } else if constexpr (Span::extent != std::dynamic_extent) {
- static_assert(S1::extent == Span::extent - Offset);
- } else {
- static_assert(S1::extent == std::dynamic_extent);
- }
+ static_assert(S1::extent == Count);
static_assert(S2::extent == std::dynamic_extent, "");
return
s1.data() == s2.data()
@@ -82,13 +76,7 @@
using S2 = decltype(s2);
ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- if constexpr (Count != std::dynamic_extent) {
- static_assert(S1::extent == Count);
- } else if constexpr (Span::extent != std::dynamic_extent) {
- static_assert(S1::extent == Span::extent - Offset);
- } else {
- static_assert(S1::extent == std::dynamic_extent);
- }
+ static_assert(S1::extent == Count);
static_assert(S2::extent == std::dynamic_extent, "");
assert(s1.data() == s2.data());
assert(s1.size() == s2.size());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73138.245236.patch
Type: text/x-patch
Size: 1580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200218/387af053/attachment.bin>
More information about the cfe-commits
mailing list