48 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// <tuple>10 11// template <class... Types> class tuple;12 13// template <class U1, class U2> tuple(const pair<U1, U2>& u);14 15// UNSUPPORTED: c++0316 17#include <tuple>18#include <utility>19#include <cassert>20 21#include "test_macros.h"22 23int main(int, char**)24{25 {26 typedef std::pair<long, char> T0;27 typedef std::tuple<long long, short> T1;28 T0 t0(2, 'a');29 T1 t1 = t0;30 assert(std::get<0>(t1) == 2);31 assert(std::get<1>(t1) == short('a'));32 }33#if TEST_STD_VER > 1134 {35 typedef std::pair<long, char> P0;36 typedef std::tuple<long long, short> T1;37 constexpr P0 p0(2, 'a');38 constexpr T1 t1 = p0;39 static_assert(std::get<0>(t1) == std::get<0>(p0), "");40 static_assert(std::get<1>(t1) == std::get<1>(p0), "");41 static_assert(std::get<0>(t1) == 2, "");42 static_assert(std::get<1>(t1) == short('a'), "");43 }44#endif45 46 return 0;47}48