| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 -fopenmp %s |
| 2 |
|
| 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 |
}; |
| 10 |
} |
| 11 |
|
| 12 |
// Okay, not an OpenMP capture. |
| 13 |
void foo(int); |
| 14 |
void g() { |
| 15 |
#pragma omp parallel |
| 16 |
{ |
| 17 |
int i[2] = {}; |
| 18 |
auto [a, b] = i; |
| 19 |
auto L = [&] { foo(a+b); }; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 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 |
| 28 |
{ |
| 29 |
// expected-error@+1 2{{capturing a structured binding is not yet supported in OpenMP}} |
| 30 |
foo(a + b); |
| 31 |
} |
| 32 |
} |