• 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 // <utility>
11 
12 // template <class T1, class T2> struct pair
13 
14 // pair(pair const&) = default;
15 // pair(pair&&) = default;
16 
17 // Doesn't pass due to use of is_trivially_* trait.
18 // XFAIL: gcc-4.9
19 
20 #include <utility>
21 #include <cassert>
22 
23 #include "test_macros.h"
24 
25 struct Dummy {
26   Dummy(Dummy const&) = delete;
27   Dummy(Dummy &&) = default;
28 };
29 
main()30 int main()
31 {
32     typedef std::pair<int, short> P;
33     {
34         static_assert(std::is_copy_constructible<P>::value, "");
35 #if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
36         static_assert(std::is_trivially_copy_constructible<P>::value, "");
37 #endif
38     }
39 #if TEST_STD_VER >= 11
40     {
41         static_assert(std::is_move_constructible<P>::value, "");
42 #if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
43         static_assert(std::is_trivially_move_constructible<P>::value, "");
44 #endif
45     }
46     {
47         using P1 = std::pair<Dummy, int>;
48         static_assert(!std::is_copy_constructible<P1>::value, "");
49         static_assert(!std::is_trivially_copy_constructible<P1>::value, "");
50         static_assert(std::is_move_constructible<P1>::value, "");
51 #if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
52         static_assert(std::is_trivially_move_constructible<P1>::value, "");
53 #endif
54     }
55 #endif
56 }
57