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

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 7 09:15:55 PDT 2021


Mordante added inline comments.


================
Comment at: libcxx/test/std/strings/string.view/trivially_copyable.compile.pass.cpp:20
+static_assert(std::is_trivially_copyable<std::basic_string_view<wchar_t> >::value, "");
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+static_assert(std::is_trivially_copyable<std::basic_string_view<char8_t> >::value, "");
----------------
jloser wrote:
> Mordante wrote:
> > Quuxplusone wrote:
> > > `#ifndef _LIBCPP_HAS_NO_CHAR8_T` plz
> > Actually I think we can remove the `#ifdef` since we only support compilers providing `char8_t`. In D110868 I've started to make the support unconditional, but that was put on hold due to the Buildkite issues. (For now I'll wait until the @ldionne's `wchar_t` changes have landed.) If you want to add an `#ifdef` please use @Quuxplusone's suggestion.
> The issue is that clang only supports `char8_t` itself in C++20 or later, but this test is run in C++03 or later, so the `#ifdef` is needed. Switched to using `#ifndef _LIBCPP_HAS_NO_CHAR8_T`.
Of course this is the `string_view` not the `span`. In that case I think it would be slightly better to guard against C++20, but I probably will update when I continue with D110868.


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