46 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++0310 11// <utility>12 13// template <class T1, class T2> struct pair14 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 25TEST_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 38int main(int, char**) {39 test();40#if TEST_STD_VER >= 2041 static_assert(test());42#endif43 44 return 0;45}46