[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCUDA / no-call-stack-for-immediate-errs.cu
blob6b967d8901322e01a5615e76005cbb30449b0c2f
1 // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -fsyntax-only -verify -Wno-vla %s
3 #include "Inputs/cuda.h"
5 // Here we should dump an error about the VLA in device_fn, but we should not
6 // print a callstack indicating how device_fn becomes known-emitted, because
7 // it's an error to use a VLA in any __device__ function, even one that doesn't
8 // get emitted.
10 inline __device__ void device_fn(int n);
11 inline __device__ void device_fn2() { device_fn(42); }
13 __global__ void kernel() { device_fn2(); }
15 inline __device__ void device_fn(int n) {
16   int vla[n]; // expected-error {{variable-length array}}