1 // RUN: %clang_cc1 -verify %s 2 // REQUIRES: thread_support 3 4 // FIXME: Detection of, or recovery from, stack exhaustion does not work on 5 // NetBSD at the moment. Since this is a best-effort mitigation for exceeding 6 // implementation limits, just disable the test. 7 // UNSUPPORTED: system-netbsd 8 9 // expected-warning@* 0-1{{stack nearly exhausted}} 10 // expected-note@* 0+{{}} 11 12 template<int N> struct X : X<N-1> {}; 13 template<> struct X<0> {}; 14 X<1000> x; 15 16 template<typename ...T> struct tuple {}; 17 template<typename ...T> auto f(tuple<T...> t) -> decltype(f(tuple<T...>(t))) {} // expected-error {{exceeded maximum depth}} 18 void g() { f(tuple<int, int>()); } 19 20 int f(X<0>); 21 template<int N> auto f(X<N>) -> f(X<N-1>()); 22 23 int k = f(X<1000>()); 24