xref: /llvm-project/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.verify.cpp (revision dc71a77d33620830020c939bba25ebdfdd1b6194)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <tuple>
10 
11 // template <class... Types> class tuple;
12 
13 // template <class Alloc, class ...UTypes>
14 //   tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...> const&);
15 
16 // UNSUPPORTED: c++03
17 
18 #include <tuple>
19 #include <memory>
20 
21 struct ExplicitCopy {
ExplicitCopyExplicitCopy22   explicit ExplicitCopy(int) {}
ExplicitCopyExplicitCopy23   explicit ExplicitCopy(ExplicitCopy const&) {}
24 
25 };
26 
const_explicit_copy_test()27 std::tuple<ExplicitCopy> const_explicit_copy_test() {
28     const std::tuple<int> t1(42);
29     return {std::allocator_arg, std::allocator<int>{}, t1};
30     // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
31 }
32 
non_const_explicit_copy_test()33 std::tuple<ExplicitCopy> non_const_explicit_copy_test() {
34     std::tuple<int> t1(42);
35     return {std::allocator_arg, std::allocator<int>{}, t1};
36     // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
37 }
38