• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: c++98, c++03
11 
12 // <utility>
13 
14 // template <class T1, class T2> struct pair
15 
16 // pair(pair&&) = default;
17 
18 #include <utility>
19 #include <memory>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 
24 struct Dummy {
25   Dummy(Dummy const&) = delete;
26   Dummy(Dummy &&) = default;
27 };
28 
main()29 int main()
30 {
31     {
32         typedef std::pair<int, short> P1;
33         static_assert(std::is_move_constructible<P1>::value, "");
34         P1 p1(3, static_cast<short>(4));
35         P1 p2 = std::move(p1);
36         assert(p2.first == 3);
37         assert(p2.second == 4);
38     }
39     {
40         using P = std::pair<Dummy, int>;
41         static_assert(!std::is_copy_constructible<P>::value, "");
42         static_assert(std::is_move_constructible<P>::value, "");
43     }
44 }
45