[libcxx-commits] [PATCH] D109286: [libc++][NFC] Test span is nothrow trivially destructible

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Sep 4 21:46:32 PDT 2021


jloser created this revision.
jloser added reviewers: ldionne, Quuxplusone, Mordante.
jloser requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Add tests showing `span` is trivially_destructible and nothrow_destructible.
Note that we do not need to explicitly default the destructor in `span`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109286

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


Index: libcxx/test/std/containers/views/span.cons/span.dtor.pass.cpp
===================================================================
--- /dev/null
+++ libcxx/test/std/containers/views/span.cons/span.dtor.pass.cpp
@@ -0,0 +1,27 @@
+//===------------------------------ span ---------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===---------------------------------------------------------------------===//
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// <span>
+
+// ~span() = default;
+
+#include <span>
+
+template <class T>
+void testDestructor() {
+  static_assert(std::is_nothrow_destructible_v<T>);
+  static_assert(std::is_trivially_destructible_v<T>);
+}
+
+int main(int, char**) {
+  testDestructor<std::span<int, 1> >();
+  testDestructor<std::span<int> >();
+
+  return 0;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109286.370780.patch
Type: text/x-patch
Size: 991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210905/fc3ce03a/attachment.bin>


More information about the libcxx-commits mailing list