summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/language.support/support.dynamic
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/language.support/support.dynamic
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/language.support/support.dynamic')
-rw-r--r--libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp26
-rw-r--r--libcxx/test/std/language.support/support.dynamic/nothrow_t.pass.cpp23
2 files changed, 49 insertions, 0 deletions
diff --git a/libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp b/libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp
new file mode 100644
index 00000000000..c1092c3516b
--- /dev/null
+++ b/libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// struct nothrow_t {
+// explicit nothrow_t() = default;
+// };
+// extern const nothrow_t nothrow;
+
+// This test checks for LWG 2510.
+
+#include <new>
+
+
+std::nothrow_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/language.support/support.dynamic/nothrow_t.pass.cpp b/libcxx/test/std/language.support/support.dynamic/nothrow_t.pass.cpp
new file mode 100644
index 00000000000..3a6231329f0
--- /dev/null
+++ b/libcxx/test/std/language.support/support.dynamic/nothrow_t.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// struct nothrow_t {
+// explicit nothrow_t() = default;
+// };
+// extern const nothrow_t nothrow;
+
+#include <new>
+
+
+int main(int, char**) {
+ std::nothrow_t x = std::nothrow;
+ (void)x;
+
+ return 0;
+}
OpenPOWER on IntegriCloud