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

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 00:39:08 PDT 2019


mclow.lists added inline comments.


================
Comment at: libcxx/test/std/containers/views/span.cons/span.fail.cpp:78
-
-//  Try to remove const and/or volatile (static -> static)
-    {
----------------
Ok. The comment here is wrong; this is testing dynamic -> static.

However, why are you removing these (failing) tests?



================
Comment at: libcxx/test/std/containers/views/span.cons/span.pass.cpp:65
     }
-
-//  dynamic -> static
----------------
These cases (on the other hand) should be moved to a failure test.


================
Comment at: libcxx/test/std/containers/views/span.cons/span.pass.cpp:80
+
+  return s1.data() == nullptr && s1.size() == 0 && s2.data() == nullptr &&
+         s2.size() == 0 && s3.data() == nullptr && s3.size() == 0;
----------------
Please line these up like the other ones were. Makes it easy to see copy-pasta errors:
```
return s1.data() == nullptr && s1.size() == 0 
    && s2.data() == nullptr && s2.size() == 0
    && s3.data() == nullptr && s3.size() == 0;
```


================
Comment at: libcxx/test/std/containers/views/span.cons/span.pass.cpp:112
+    std::span<Dest> s3(s0d);    // static -> dynamic
+    return s1.data() == nullptr && s1.size() == 0 && s2.data() == nullptr &&
+           s2.size() == 0 && s3.data() == nullptr && s3.size() == 0;
----------------
same comment as above re: alignment.


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

https://reviews.llvm.org/D69520





More information about the cfe-commits mailing list