Files
TheRock/compiler/amd-llvm/clang/test/SemaTemplate/stack-exhaustion.cpp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

70 lines
2.0 KiB
C++

// RUN: %clang_cc1 -verify %s -DTEST=1
// RUN: %clang_cc1 -verify %s -DTEST=2
// RUN: %clang_cc1 -verify %s -DTEST=3
// RUN: %clang_cc1 -verify %s -DTEST=1 -fexperimental-new-constant-interpreter
// RUN: %clang_cc1 -verify %s -DTEST=2 -fexperimental-new-constant-interpreter
// RUN: %clang_cc1 -verify %s -DTEST=3 -fexperimental-new-constant-interpreter
// REQUIRES: thread_support
// FIXME: Detection of, or recovery from, stack exhaustion does not work on
// NetBSD at the moment. Since this is a best-effort mitigation for exceeding
// implementation limits, just disable the test.
// UNSUPPORTED: system-netbsd
// asan has own stack-overflow check.
// UNSUPPORTED: asan
// expected-warning@* 0-1{{stack nearly exhausted}}
// expected-note@* 0+{{}}
#if TEST == 1
template<int N> struct X : X<N-1> {};
template<> struct X<0> {};
X<1000> x;
template<typename ...T> struct tuple {};
template<typename ...T> auto f(tuple<T...> t) -> decltype(f(tuple<T...>(t))) {} // expected-error {{exceeded maximum depth}}
void g() { f(tuple<int, int>()); }
int f(X<0>);
template<int N> auto f(X<N>) -> f(X<N-1>());
int k = f(X<1000>());
#elif TEST == 2
namespace template_argument_recursion {
struct ostream;
template<typename T> T &&declval();
namespace mlir {
template<typename T, typename = decltype(declval<ostream&>() << declval<T&>())>
ostream &operator<<(ostream& os, const T& obj); // expected-error {{exceeded maximum depth}}
struct Value;
}
void printFunctionalType(ostream &os, mlir::Value &v) { os << v; }
}
#elif TEST == 3
namespace template_parameter_type_recursion {
struct ostream;
template<typename T> T &&declval();
template<bool B, typename T> struct enable_if { using type = T; };
namespace mlir {
template<typename T, typename enable_if<declval<ostream&>() << declval<T&>(), void*>::type = nullptr>
ostream &operator<<(ostream& os, const T& obj); // expected-error {{exceeded maximum depth}}
struct Value;
}
void printFunctionalType(ostream &os, mlir::Value &v) { os << v; }
}
#else
#error unknown test
#endif