Timm Baeder 159f253017
[clang][bytecode] Diagnose invalid declrefs differently if we've... (#113140)
... tried their initializer already. In that case, diagnose the
non-const initializer instead of the reference to a non-constexpr
variable later. This is used in a lot of openmp tests.
2024-10-21 12:07:09 +02:00

14 lines
415 B
C++

// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both -fopenmp %s
// RUN: %clang_cc1 -verify=ref,both -fopenmp %s
int test1() {
int i;
int &j = i; // both-note {{declared here}}
float *f;
// both-note@+2 {{initializer of 'j' is not a constant expression}}
// both-error@+1 {{integral constant expression}}
#pragma omp for simd aligned(f:j)
for (int i = 0; i < 10; ++i);
}