Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / utility / pairs / pairs.spec / make_pair.pass.cpp
blob3670c023240e8382d0e13b8631bd35d063a1121a
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 //===----------------------------------------------------------------------===//
9 // <utility>
11 // template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&);
13 #include <utility>
14 #include <memory>
15 #include <cassert>
17 #include "test_macros.h"
19 int main(int, char**)
22 typedef std::pair<int, short> P1;
23 P1 p1 = std::make_pair(3, static_cast<short>(4));
24 assert(p1.first == 3);
25 assert(p1.second == 4);
28 #if TEST_STD_VER >= 11
30 typedef std::pair<std::unique_ptr<int>, short> P1;
31 P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), static_cast<short>(4));
32 assert(*p1.first == 3);
33 assert(p1.second == 4);
36 typedef std::pair<std::unique_ptr<int>, short> P1;
37 P1 p1 = std::make_pair(nullptr, static_cast<short>(4));
38 assert(p1.first == nullptr);
39 assert(p1.second == 4);
41 #endif
42 #if TEST_STD_VER >= 14
44 typedef std::pair<int, short> P1;
45 constexpr P1 p1 = std::make_pair(3, static_cast<short>(4));
46 static_assert(p1.first == 3, "");
47 static_assert(p1.second == 4, "");
49 #endif
52 return 0;