| 1 |
// PR c++/116676 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
|
| 4 |
namespace std { |
| 5 |
typedef __SIZE_TYPE__ size_t; |
| 6 |
|
| 7 |
template<typename _Tp> |
| 8 |
struct remove_reference |
| 9 |
{ typedef _Tp type; }; |
| 10 |
|
| 11 |
template<typename _Tp> |
| 12 |
struct remove_reference<_Tp&> |
| 13 |
{ typedef _Tp type; }; |
| 14 |
|
| 15 |
template<typename _Tp> |
| 16 |
struct remove_reference<_Tp&&> |
| 17 |
{ typedef _Tp type; }; |
| 18 |
|
| 19 |
template <typename _Tp> |
| 20 |
constexpr typename std::remove_reference<_Tp>::type && |
| 21 |
move(_Tp &&__t) noexcept { |
| 22 |
return static_cast<typename std::remove_reference<_Tp>::type &&>(__t); |
| 23 |
} |
| 24 |
template <typename _Tp> struct tuple_size; |
| 25 |
template <size_t __i, typename _Tp> struct tuple_element; |
| 26 |
template <typename _U1, typename _U2> class __pair_base {}; |
| 27 |
template <typename _T1, typename _T2> |
| 28 |
struct pair { |
| 29 |
_T1 first; |
| 30 |
_T2 second; |
| 31 |
template <typename _U1 = _T1, typename _U2 = _T2> |
| 32 |
explicit constexpr pair(const _T1 &__a, const _T2 &__b) |
| 33 |
: first(__a), second(__b) {} |
| 34 |
}; |
| 35 |
template <class _Tp1, class _Tp2> |
| 36 |
struct tuple_size<pair<_Tp1, _Tp2>> |
| 37 |
{ |
| 38 |
static constexpr size_t value = 2; |
| 39 |
}; |
| 40 |
template <class _Tp1, class _Tp2> |
| 41 |
struct tuple_element<0, pair<_Tp1, _Tp2>> { |
| 42 |
typedef _Tp1 type; |
| 43 |
}; |
| 44 |
template <class _Tp1, class _Tp2> |
| 45 |
struct tuple_element<1, pair<_Tp1, _Tp2>> { |
| 46 |
typedef _Tp2 type; |
| 47 |
}; |
| 48 |
|
| 49 |
template <size_t _Int, class _Tp1, class _Tp2> |
| 50 |
constexpr typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type & |
| 51 |
get(pair<_Tp1, _Tp2> &&__in) noexcept { |
| 52 |
return (std::move(__in).first); |
| 53 |
} |
| 54 |
int t; |
| 55 |
auto [a, b] = std::pair<int&, int>{t, 1}; |
| 56 |
} |
| 57 |
|