blob: 48e09735abb0296cf1b2536100ec6cb05447586f [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
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
18int main()
19{
20 {
21 typedef std::pair<int, short> P1;
22 P1 p1 = std::make_pair(3, 4);
23 assert(p1.first == 3);
24 assert(p1.second == 4);
25 }
Dan Albert1d4a1ed2016-05-25 22:36:09 -070026
Howard Hinnant73d21a42010-09-04 23:28:19 +000027#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000028 {
29 typedef std::pair<std::unique_ptr<int>, short> P1;
30 P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), 4);
31 assert(*p1.first == 3);
32 assert(p1.second == 4);
33 }
34 {
35 typedef std::pair<std::unique_ptr<int>, short> P1;
36 P1 p1 = std::make_pair(nullptr, 4);
37 assert(p1.first == nullptr);
38 assert(p1.second == 4);
39 }
Howard Hinnant73d21a42010-09-04 23:28:19 +000040#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Marshall Clow206f6cd2013-07-16 17:45:44 +000041
42#if _LIBCPP_STD_VER > 11
43 {
44 typedef std::pair<int, short> P1;
45 constexpr P1 p1 = std::make_pair(3, 4);
46 static_assert(p1.first == 3, "");
47 static_assert(p1.second == 4, "");
48 }
49#endif
50
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000051}