summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2019-09-26 14:51:10 +0000
committerLouis Dionne <ldionne@apple.com>2019-09-26 14:51:10 +0000
commite16f2cb6789286dbfa4a184cef25b91dfb499206 (patch)
treef67676d1b91559354b68e3e9860e0ee4aae2705f /libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp
parent1822087facdfaeac69dcd14690866a4d872e3fdb (diff)
downloadbcm5719-llvm-e16f2cb6789286dbfa4a184cef25b91dfb499206.tar.gz
bcm5719-llvm-e16f2cb6789286dbfa4a184cef25b91dfb499206.zip
[libc++] Take 2: 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. This was previously committed as r372777 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372983
Diffstat (limited to 'libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp')
-rw-r--r--libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp30
1 files changed, 30 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..78ab087c3ea
--- /dev/null
+++ b/libcxx/test/std/language.support/support.dynamic/nothrow_t.fail.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// Before GCC 6, aggregate initialization kicks in.
+// See https://stackoverflow.com/q/41799015/627587.
+// UNSUPPORTED: gcc-5
+
+// 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;
+}
OpenPOWER on IntegriCloud