[PATCH] D69520: [libc++] Disallow dynamic -> static span conversions

Jan Wilken Dörrie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 11:22:00 PDT 2019


jdoerrie updated this revision to Diff 226713.
jdoerrie added a comment.

Formatting


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69520/new/

https://reviews.llvm.org/D69520

Files:
  libcxx/test/std/containers/views/span.cons/span.pass.cpp


Index: libcxx/test/std/containers/views/span.cons/span.pass.cpp
===================================================================
--- libcxx/test/std/containers/views/span.cons/span.pass.cpp
+++ libcxx/test/std/containers/views/span.cons/span.pass.cpp
@@ -105,13 +105,12 @@
 {
     static_assert(std::is_convertible_v<Src(*)[], Dest(*)[]>, "Bad input types to 'testConversionSpan");
     std::span<Src>    s0d{};
-    std::span<Src>    s0s{};
+    std::span<Src, 0> s0s{};
     std::span<Dest> s1(s0d);    // dynamic -> dynamic
     std::span<Dest, 0> s2(s0s); // static -> static
     std::span<Dest> s3(s0d);    // static -> dynamic
-    s1.data() == nullptr&& s1.size() == 0 &&
-        s2.data() == nullptr&& s2.size() == 0 &&
-        s3.data() == nullptr&& s3.size() == 0;
+    return s1.data() == nullptr && s1.size() == 0 && s2.data() == nullptr &&
+           s2.size() == 0 && s3.data() == nullptr && s3.size() == 0;
 }
 
 struct A{};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69520.226713.patch
Type: text/x-patch
Size: 947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191028/777d0144/attachment.bin>


More information about the cfe-commits mailing list