aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25a.C
blob: 74ef1e4d890b932e2fc00648dd2a81e1e65d15a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// PR c++/118626
// { dg-do compile { target c++20 } }

template<long> struct _Nth_type { using type = _Nth_type; };

template<class _Up>
struct variant {
  template<class _Tp> static constexpr long __accepted_index = 0;
  template<long _Np> using __to_type = typename _Nth_type<_Np>::type;
  template<class _Tp, int = sizeof(_Tp)> using __accepted_type = __to_type<__accepted_index<_Tp>>;
  template<class = __accepted_type<_Up>> variant(_Up);
};

template<class _Tp>
struct Node { Node(_Tp); };

template<class R> using Tree = variant<Node<R>>;
using type = decltype(Tree{Node{42}});
using type = Tree<int>;