• 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> pair<V1, V2> make_pair(T1&&, T2&&);
13 
14 #include <utility>
15 #include <memory>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 
main()20 int main()
21 {
22     {
23         typedef std::pair<int, short> P1;
24         P1 p1 = std::make_pair(3, static_cast<short>(4));
25         assert(p1.first == 3);
26         assert(p1.second == 4);
27     }
28 
29 #if TEST_STD_VER >= 11
30     {
31         typedef std::pair<std::unique_ptr<int>, short> P1;
32         P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), static_cast<short>(4));
33         assert(*p1.first == 3);
34         assert(p1.second == 4);
35     }
36     {
37         typedef std::pair<std::unique_ptr<int>, short> P1;
38         P1 p1 = std::make_pair(nullptr, static_cast<short>(4));
39         assert(p1.first == nullptr);
40         assert(p1.second == 4);
41     }
42 #endif
43 #if TEST_STD_VER >= 14
44     {
45         typedef std::pair<int, short> P1;
46         constexpr P1 p1 = std::make_pair(3, static_cast<short>(4));
47         static_assert(p1.first == 3, "");
48         static_assert(p1.second == 4, "");
49     }
50 #endif
51 
52 }
53