Files
TheRock/compiler/amd-llvm/clang/test/Sema/unroll-template-value-crash.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

72 lines
1.8 KiB
C++

// RUN: %clang_cc1 -x c++ -verify %s
template <int Unroll> void foo() {
#pragma unroll Unroll
for (int i = 0; i < Unroll; ++i);
#pragma GCC unroll Unroll
for (int i = 0; i < Unroll; ++i);
}
struct val {
constexpr operator int() const { return 1; }
};
// generic lambda (using double template instantiation)
template<typename T>
void use(T t) {
auto lam = [](auto N) {
#pragma clang loop unroll_count(N+1)
for (int i = 0; i < 10; ++i);
#pragma unroll N+1
for (int i = 0; i < 10; ++i);
#pragma GCC unroll N+1
for (int i = 0; i < 10; ++i);
};
lam(t);
}
void test() {
use(val());
}
template <typename T> void pr49502(T v) {
#pragma GCC unroll v() // expected-error {{called object type 'int' is not a function or function pointer}}
for (;;) {
}
}
void pr49502_caller() {
pr49502(0); // expected-note {{in instantiation of function template specialization 'pr49502<int>' requested here}}
}
template <typename T, typename U> struct pr49502_partial;
template <typename T> struct pr49502_partial<T, T> {
static void dependent(T v) {
#pragma GCC unroll v() // expected-error {{called object type 'int' is not a function or function pointer}}
for (;;) {
}
}
static void mixed(T v) {
#pragma GCC unroll v() + 1 // expected-error {{called object type 'int' is not a function or function pointer}}
for (;;) {
}
}
static void non_dependent(int v) {
#pragma GCC unroll v() // expected-error {{called object type 'int' is not a function or function pointer}}
for (;;) {
}
}
};
void pr49502_partial_caller() {
pr49502_partial<int, int>::dependent(0); // expected-note {{in instantiation of member function 'pr49502_partial<int, int>::dependent' requested here}}
pr49502_partial<int, int>::mixed(0); // expected-note {{in instantiation of member function 'pr49502_partial<int, int>::mixed' requested here}}
}