[libcxx-commits] [PATCH] D111197: [libc++] Verify span and string_view are trivially copyable

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 5 18:10:36 PDT 2021


Quuxplusone requested changes to this revision.
Quuxplusone added inline comments.
This revision now requires changes to proceed.


================
Comment at: libcxx/test/std/containers/views/trivially_copyable.compile.pass.cpp:18-23
+struct UserDefinedNonTrival {
+  UserDefinedNonTrival() {}
+  UserDefinedNonTrival(const UserDefinedNonTrival&) {}
+};
+static_assert(std::is_trivially_copyable_v<std::span<UserDefinedNonTrival>>);
+static_assert(std::is_trivially_copyable_v<std::span<UserDefinedNonTrival, 3>>);
----------------
(1) s/Trival/Trivial/g
(2) I don't think lines 18–23 are needed at all. We can trust that `span` doesn't do anything stupidly depending on the type-the-pointer-points-to.


================
Comment at: libcxx/test/std/strings/string.view/trivially_copyable.compile.pass.cpp:9
+
+// <string_view>
+
----------------
This surely needs some `// UNSUPPORTED: c++03, c++11, c++14`, but buildkite will tell you for sure.
...Actually, it looks like libc++ supports `string_view` as an extension all the way back to C++03? is that true? So you'll want to use `static_assert(std::is_trivially_copyable<...>::value, "");` below.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111197



More information about the libcxx-commits mailing list