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());


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());
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to