1 // PR c++/79501 2 // { dg-do compile { target c++17 } } 3 // A variant of class-deduction78.C where List and its deduction guides are 4 // defined at class scope. 5 6 using size_t = decltype(sizeof(42)); 7 8 struct A { 9 template<typename T, size_t N = 0> 10 struct List { 11 T head; 12 List<T, N-1> tail; 13 }; 14 15 template<typename T> 16 struct List<T, 0> {}; 17 18 template<typename T> List(T) -> List<T, 1>; 19 template<typename T, size_t N> List(T, List<T, N>) -> List<T, N+1>; 20 }; 21 22 int main() { 23 using type = decltype(A::List{0, A::List{1, A::List{2}}}); 24 using type = A::List<int, 3>; 25 } 26