[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / decomposition-openmp.cpp
blob2185f3db83d4e25dd11f21c0e8b581258f2c094d
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 -fopenmp %s
3 // Okay, not an OpenMP capture.
4 auto f() {
5 int i[2] = {};
6 auto [a, b] = i;
7 return [=, &a] {
8 return a + b;
9 };
12 // Okay, not an OpenMP capture.
13 void foo(int);
14 void g() {
15 #pragma omp parallel
17 int i[2] = {};
18 auto [a, b] = i;
19 auto L = [&] { foo(a+b); };
23 // FIXME: OpenMP should support capturing structured bindings
24 void h() {
25 int i[2] = {};
26 auto [a, b] = i; // expected-note 2{{declared here}}
27 #pragma omp parallel
29 // expected-error@+1 2{{capturing a structured binding is not yet supported in OpenMP}}
30 foo(a + b);