-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenMP] Move unsupported structured bindings diagnostic (#80216)
Move the diagnostic so it fires only when doing an OpenMP capture, not for non-OpenMP captures. This allows non-OpenMP code to work when using OpenMP elsewhere, such as the code reported in #66999.
- Loading branch information
1 parent
87e04b4
commit de1ea78
Showing
2 changed files
with
32 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
|
||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 -fopenmp %s | ||
|
||
// FIXME: OpenMP should support capturing structured bindings | ||
// Okay, not an OpenMP capture. | ||
auto f() { | ||
int i[2] = {}; | ||
auto [a, b] = i; // expected-note 2{{declared here}} | ||
auto [a, b] = i; | ||
return [=, &a] { | ||
// expected-error@-1 {{capturing a structured binding is not yet supported in OpenMP}} | ||
return a + b; | ||
// expected-error@-1 {{capturing a structured binding is not yet supported in OpenMP}} | ||
}; | ||
} | ||
|
||
// 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); | ||
} | ||
} |