aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaCXX/decomposition-openmp.cpp
blob: 2185f3db83d4e25dd11f21c0e8b581258f2c094d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 -fopenmp %s

// Okay, not an OpenMP capture.
auto f() {
  int i[2] = {};
  auto [a, b] = i;
  return [=, &a] {
    return a + b;
  };
}

// Okay, not an OpenMP capture.
void foo(int);
void g() {
  #pragma omp parallel
  {
    int i[2] = {};
    auto [a, b] = i;
    auto L = [&] { foo(a+b); };
  }
}

// FIXME: OpenMP should support capturing structured bindings
void h() {
  int i[2] = {};
  auto [a, b] = i; // expected-note 2{{declared here}}
  #pragma omp parallel
  {
    // expected-error@+1 2{{capturing a structured binding is not yet supported in OpenMP}}
    foo(a + b);
  }
}