| 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 |
// <utility> |
| 10 |
|
| 11 |
// template <class T1, class T2> struct pair |
| 12 |
|
| 13 |
// template<size_t I, class T1, class T2> |
| 14 |
// const typename tuple_element<I, std::pair<T1, T2> >::type& |
| 15 |
// get(const pair<T1, T2>&); |
| 16 |
|
| 17 |
#include <utility> |
| 18 |
#include <cassert> |
| 19 |
|
| 20 |
#include "test_macros.h" |
| 21 |
|
| 22 |
int main(int, char**) |
| 23 |
{ |
| 24 |
{ |
| 25 |
typedef std::pair<int, short> P; |
| 26 |
const P p(3, static_cast<short>(4)); |
| 27 |
assert(std::get<0>(p) == 3); |
| 28 |
assert(std::get<1>(p) == 4); |
| 29 |
} |
| 30 |
|
| 31 |
#if TEST_STD_VER > 11 |
| 32 |
{ |
| 33 |
typedef std::pair<int, short> P; |
| 34 |
constexpr P p1(3, static_cast<short>(4)); |
| 35 |
static_assert(std::get<0>(p1) == 3, ""); |
| 36 |
static_assert(std::get<1>(p1) == 4, ""); |
| 37 |
} |
| 38 |
#endif |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |