[PATCH] D73138: [libcxx] [test] Correct asserted type in subspan test; subspan with count should never produce dynamic_extent

Billy Robert O'Neal III via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 13:37:55 PST 2020


BillyONeal created this revision.
BillyONeal added reviewers: ldionne, EricWF, mclow.lists.
Herald added subscribers: dexonsmith, christof.

I'm not sure if this was a change in the standard behavior or if it was a typo in libcxx from the beginning. http://eel.is/c++draft/span.sub#10 says that if a count is supplied, the returned span is always of that count, never of dynamic_extent, so these tests were asserting incorrectly.

I'm not sure what to do about this as fixing the test to assert correctly (and thus make msvc++ pass) is going to make libcxx fail.


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,7 +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);
-    static_assert(S1::extent == (Span::extent == std::dynamic_extent ? std::dynamic_extent : Count), "");
+    static_assert(S1::extent == Count, "");
     static_assert(S2::extent == std::dynamic_extent, "");
     return
         s1.data() == s2.data()
@@ -76,7 +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);
-    static_assert(S1::extent == (Span::extent == std::dynamic_extent ? std::dynamic_extent : Count), "");
+    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.239423.patch
Type: text/x-patch
Size: 1196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200121/ac0bbf1d/attachment-0001.bin>


More information about the cfe-commits mailing list