aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25.C
blob: 37ab932c2cc3904f6672f3d193601e1c84db0a22 (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;

template<class _Up>
struct variant {
  template<class _Tp> static constexpr long __accepted_index = 0;
  template<long _Np> using __to_type = _Nth_type<_Np>;
  template<class _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>;