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 // UNSUPPORTED: c++03
10
11 // <utility>
12
13 // template <class T1, class T2> struct pair
14
15 // template <class... Args1, class... Args2>
16 // pair(piecewise_construct_t, tuple<Args1...> first_args,
17 // tuple<Args2...> second_args);
18
19 #include <cassert>
20 #include <tuple>
21 #include <utility>
22
23 #include "test_macros.h"
24
test()25 TEST_CONSTEXPR_CXX20 bool test() {
26 {
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));
34 }
35 return true;
36 }
37
main(int,char **)38 int main(int, char**) {
39 test();
40 #if TEST_STD_VER >= 20
41 static_assert(test());
42 #endif
43
44 return 0;
45 }
46