Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / utility / pairs / pairs.pair / ctor.piecewise_construct.pass.cpp
blob37bbb9501769c4c3c4fc5cd533eb350137ac635a
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 // UNSUPPORTED: c++03
11 // <utility>
13 // template <class T1, class T2> struct pair
15 // template <class... Args1, class... Args2>
16 // pair(piecewise_construct_t, tuple<Args1...> first_args,
17 // tuple<Args2...> second_args);
19 #include <cassert>
20 #include <tuple>
21 #include <utility>
23 #include "test_macros.h"
25 TEST_CONSTEXPR_CXX20 bool test() {
27 typedef std::pair<int, int*> P1;
28 typedef std::pair<int*, int> P2;
29 typedef std::pair<P1, P2> P3;
30 P3 p3(std::piecewise_construct, std::tuple<int, int*>(3, nullptr),
31 std::tuple<int*, int>(nullptr, 4));
32 assert(p3.first == P1(3, nullptr));
33 assert(p3.second == P2(nullptr, 4));
35 return true;
38 int main(int, char**) {
39 test();
40 #if TEST_STD_VER >= 20
41 static_assert(test());
42 #endif
44 return 0;