[libcxx-commits] [PATCH] D62618: [libcxx] Make std::tuple<> trivially constructible
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 29 12:12:22 PDT 2019
ldionne created this revision.
ldionne added reviewers: mclow.lists, EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, christof.
Herald added a project: libc++.
This is not mandated by the Standard, but it's nonetheless a nice
property to have, especially since it's so easy to implement. It
also shrinks our bug list!
PR41714
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D62618
Files:
libcxx/include/tuple
libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/empty_tuple_trivial.pass.cpp
Index: libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/empty_tuple_trivial.pass.cpp
===================================================================
--- /dev/null
+++ libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/empty_tuple_trivial.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// This test ensures that std::tuple<> is trivially constructible. That is not
+// required by the Standard, but libc++ provides that guarantee.
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <type_traits>
+
+
+static_assert(std::is_trivially_constructible<std::tuple<>>::value, "");
+
+int main(int, char**) {
+ return 0;
+}
Index: libcxx/include/tuple
===================================================================
--- libcxx/include/tuple
+++ libcxx/include/tuple
@@ -907,7 +907,7 @@
{
public:
_LIBCPP_INLINE_VISIBILITY
- _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}
+ _LIBCPP_CONSTEXPR tuple() _NOEXCEPT _LIBCPP_DEFAULT
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62618.202018.patch
Type: text/x-patch
Size: 1437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190529/b0176c47/attachment.bin>
More information about the libcxx-commits
mailing list