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

source code of libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.copy_move_trivial.pass.cpp