1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <tuple>
11 
12 // template <class... Types> class tuple;
13 
14 // template <class U1, class U2> tuple(const pair<U1, U2>& u);
15 
16 // UNSUPPORTED: c++98, c++03
17 
18 #include <tuple>
19 #include <utility>
20 #include <cassert>
21 
main()22 int main()
23 {
24     {
25         typedef std::pair<double, char> T0;
26         typedef std::tuple<int, short> T1;
27         T0 t0(2.5, 'a');
28         T1 t1 = t0;
29         assert(std::get<0>(t1) == 2);
30         assert(std::get<1>(t1) == short('a'));
31     }
32 #if _LIBCPP_STD_VER > 11
33     {
34         typedef std::pair<double, char> P0;
35         typedef std::tuple<int, short> T1;
36         constexpr P0 p0(2.5, 'a');
37         constexpr T1 t1 = p0;
38         static_assert(std::get<0>(t1) != std::get<0>(p0), "");
39         static_assert(std::get<1>(t1) == std::get<1>(p0), "");
40         static_assert(std::get<0>(t1) == 2, "");
41         static_assert(std::get<1>(t1) == short('a'), "");
42     }
43 #endif
44 }
45