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

using size_t = decltype(sizeof(42));

template<typename T, size_t N = 0>
struct List {
    T head;
    List<T, N-1> tail;
};

template<typename T>
struct List<T, 0> {};

template<typename T> List(T) -> List<T, 1>;
template<typename T, size_t N> List(T, List<T, N>) -> List<T, N+1>;

int main() {
  auto list2 = List{0, List{1, List{2}}};
}