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 U1, class U2>
14 //   tuple& operator=(pair<U1, U2>&& u);
15 
16 // UNSUPPORTED: c++03
17 
18 #include <tuple>
19 #include <utility>
20 #include <memory>
21 #include <cassert>
22 
23 #include "test_macros.h"
24 
25 struct B
26 {
27     int id_;
28 
29     explicit B(int i = 0) : id_(i) {}
30 
31     virtual ~B() {}
32 };
33 
34 struct D
35     : B
36 {
37     explicit D(int i) : B(i) {}
38 };
39 
40 int main(int, char**)
41 {
42     {
43         typedef std::pair<long, std::unique_ptr<D>> T0;
44         typedef std::tuple<long long, std::unique_ptr<B>> T1;
45         T0 t0(2, std::unique_ptr<D>(new D(3)));
46         T1 t1;
47         t1 = std::move(t0);
48         assert(std::get<0>(t1) == 2);
49         assert(std::get<1>(t1)->id_ == 3);
50     }
51 
52   return 0;
53 }
54