clang/test/SemaOpenMP/atomic-capture-const-no-crash.c
raw| 1 | // RUN: %clang_cc1 -fopenmp-simd -fsyntax-only -verify %s |
| 2 | // see https://github.com/llvm/llvm-project/issues/69069 |
| 3 | // or https://github.com/llvm/llvm-project/pull/71480 |
| 4 | |
| 5 | void test() { |
| 6 | int v; const int x = 0; // expected-note {{variable 'x' declared const here}} |
| 7 | #pragma omp atomic capture |
| 8 | { |
| 9 | v = x; |
| 10 | x = 1; // expected-error {{cannot assign to variable 'x' with const-qualified type 'const int'}} |
| 11 | } |
| 12 | } |