1 // RUN: %clangxx -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
2 
3 // Test that symbolizer does not crash on frame with large function name.
4 
5 // On Darwin LSan reports a false positive
6 // XFAIL: darwin && lsan
7 
8 // FIXME: https://github.com/llvm/llvm-project/issues/55460
9 // On Linux its possible for symbolizer output to be truncated and to match the
10 // check below. Remove when the underlying problem has been addressed.
11 // UNSUPPORTED: linux
12 
13 #include <sanitizer/common_interface_defs.h>
14 #include <vector>
15 
16 template <int N> struct A {
17   template <class T> void RecursiveTemplateFunction(const T &t);
18 };
19 
20 template <int N>
21 template <class T>
22 __attribute__((noinline)) void A<N>::RecursiveTemplateFunction(const T &) {
23   std::vector<T> t;
24   return A<N - 1>().RecursiveTemplateFunction(t);
25 }
26 
27 template <>
28 template <class T>
29 __attribute__((noinline)) void A<0>::RecursiveTemplateFunction(const T &) {
30   __sanitizer_print_stack_trace();
31 }
32 
33 int main() {
34   // CHECK: {{vector<.*vector<.*vector<.*vector<.*vector<}}
35   A<10>().RecursiveTemplateFunction(0);
36 }
37