summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/memory
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2019-09-24 20:18:54 +0000
committerLouis Dionne <ldionne@apple.com>2019-09-24 20:18:54 +0000
commit95411dd426e6ea5b13c8f1bb7c4ba7190ecd6c1a (patch)
treec855a112fdf1c8beb265b722df01b8f8d95e113f /libcxx/test/std/utilities/memory
parent19712415a57509f722c0552550cbc308c25bde7b (diff)
downloadbcm5719-llvm-95411dd426e6ea5b13c8f1bb7c4ba7190ecd6c1a.tar.gz
bcm5719-llvm-95411dd426e6ea5b13c8f1bb7c4ba7190ecd6c1a.zip
[libc++] Implement LWG 2510
Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372777
Diffstat (limited to 'libcxx/test/std/utilities/memory')
-rw-r--r--libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.fail.cpp25
-rw-r--r--libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.pass.cpp4
2 files changed, 27 insertions, 2 deletions
diff --git a/libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.fail.cpp b/libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.fail.cpp
new file mode 100644
index 00000000000..2b8d09afaae
--- /dev/null
+++ b/libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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++98, c++03
+
+// <memory>
+
+// struct allocator_arg_t { explicit allocator_arg_t() = default; };
+// const allocator_arg_t allocator_arg = allocator_arg_t();
+
+// This test checks for LWG 2510.
+
+#include <memory>
+
+
+std::allocator_arg_t f() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
+
+int main(int, char**) {
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.pass.cpp b/libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.pass.cpp
index 0253243319a..e22bec1e514 100644
--- a/libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.pass.cpp
+++ b/libcxx/test/std/utilities/memory/allocator.tag/allocator_arg.pass.cpp
@@ -8,7 +8,7 @@
// <memory>
-// struct allocator_arg_t { };
+// struct allocator_arg_t { explicit allocator_arg_t() = default; };
// const allocator_arg_t allocator_arg = allocator_arg_t();
#include <memory>
@@ -21,5 +21,5 @@ int main(int, char**)
{
test(std::allocator_arg);
- return 0;
+ return 0;
}
OpenPOWER on IntegriCloud