Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25a.C

raw
1 // PR c++/118626
2 // { dg-do compile { target c++20 } }
3
4 template<long> struct _Nth_type { using type = _Nth_type; };
5
6 template<class _Up>
7 struct variant {
8 template<class _Tp> static constexpr long __accepted_index = 0;
9 template<long _Np> using __to_type = typename _Nth_type<_Np>::type;
10 template<class _Tp, int = sizeof(_Tp)> using __accepted_type = __to_type<__accepted_index<_Tp>>;
11 template<class = __accepted_type<_Up>> variant(_Up);
12 };
13
14 template<class _Tp>
15 struct Node { Node(_Tp); };
16
17 template<class R> using Tree = variant<Node<R>>;
18 using type = decltype(Tree{Node{42}});
19 using type = Tree<int>;