aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-116676.C
blob: 1cb65f10a1d1a30c2cbb4cedc56d8e33fc2005f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// PR c++/116676
// { dg-do compile { target c++17 } }

namespace std {
typedef __SIZE_TYPE__ size_t;

  template<typename _Tp>
    struct remove_reference
    { typedef _Tp type; };

  template<typename _Tp>
    struct remove_reference<_Tp&>
    { typedef _Tp type; };

  template<typename _Tp>
    struct remove_reference<_Tp&&>
    { typedef _Tp type; };

template <typename _Tp>
constexpr typename std::remove_reference<_Tp>::type &&
move(_Tp &&__t) noexcept {
  return static_cast<typename std::remove_reference<_Tp>::type &&>(__t);
}
template <typename _Tp> struct tuple_size;
template <size_t __i, typename _Tp> struct tuple_element;
template <typename _U1, typename _U2> class __pair_base {};
template <typename _T1, typename _T2>
struct pair {
  _T1 first;
  _T2 second;
  template <typename _U1 = _T1, typename _U2 = _T2>
  explicit constexpr pair(const _T1 &__a, const _T2 &__b)
      : first(__a), second(__b) {}
};
template <class _Tp1, class _Tp2>
struct tuple_size<pair<_Tp1, _Tp2>>
{
static constexpr size_t value = 2;
};
template <class _Tp1, class _Tp2>
struct tuple_element<0, pair<_Tp1, _Tp2>> {
  typedef _Tp1 type;
};
template <class _Tp1, class _Tp2>
struct tuple_element<1, pair<_Tp1, _Tp2>> {
  typedef _Tp2 type;
};

template <size_t _Int, class _Tp1, class _Tp2>
constexpr typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type &
get(pair<_Tp1, _Tp2> &&__in) noexcept {
  return (std::move(__in).first);
}
int t;
auto [a, b] = std::pair<int&, int>{t, 1};
}