From 95411dd426e6ea5b13c8f1bb7c4ba7190ecd6c1a Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 24 Sep 2019 20:18:54 +0000 Subject: [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 --- .../tuple/tuple.tuple/tuple.cnstr/default.fail.cpp | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.fail.cpp (limited to 'libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.fail.cpp') diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.fail.cpp new file mode 100644 index 00000000000..f25450af63b --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.fail.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// + +// template class tuple; + +// explicit(see-below) constexpr tuple(); + +#include + + +struct Implicit { + Implicit() = default; +}; + +struct Explicit { + explicit Explicit() = default; +}; + +std::tuple<> test1() { return {}; } + +std::tuple test2() { return {}; } +std::tuple test3() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} + +std::tuple test4() { return {}; } +std::tuple test5() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} +std::tuple test6() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} +std::tuple test7() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} + +std::tuple test8() { return {}; } +std::tuple test9() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} +std::tuple test10() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} +std::tuple test11() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} +std::tuple test12() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} +std::tuple test13() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} +std::tuple test14() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} +std::tuple test15() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}} + +int main(int, char**) { + return 0; +} -- cgit v1.2.3