[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / parallel_copyin_messages.cpp
blob4064b020228a885f9318fb19114eeda624f4d305
1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
5 void foo() {
8 bool foobool(int argc) {
9 return argc;
12 struct S1; // expected-note {{declared here}}
13 class S2 {
14 mutable int a;
15 public:
16 S2():a(0) { }
17 S2 & operator =(S2 &s2) { return *this; }
19 class S3 {
20 int a;
21 public:
22 S3():a(0) { }
23 S3 &operator =(S3 &s3) { return *this; }
25 class S4 {
26 int a;
27 S4();
28 S4 &operator =(const S4 &s4); // expected-note {{implicitly declared private here}}
29 public:
30 S4(int v):a(v) { }
32 class S5 {
33 int a;
34 S5():a(0) {}
35 S5 &operator =(const S5 &s5) { return *this; } // expected-note {{implicitly declared private here}}
36 public:
37 S5(int v):a(v) { }
39 template <class T>
40 class ST {
41 public:
42 static T s;
45 namespace A {
46 double x;
47 #pragma omp threadprivate(x)
49 namespace B {
50 using A::x;
53 S2 k;
54 S3 h;
55 S4 l(3);
56 S5 m(4);
57 #pragma omp threadprivate(h, k, l, m)
59 int main(int argc, char **argv) {
60 int i;
61 #pragma omp parallel copyin // expected-error {{expected '(' after 'copyin'}}
62 #pragma omp parallel copyin ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
63 #pragma omp parallel copyin () // expected-error {{expected expression}}
64 #pragma omp parallel copyin (k // expected-error {{expected ')'}} expected-note {{to match this '('}}
65 #pragma omp parallel copyin (h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
66 #pragma omp parallel copyin (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
67 #pragma omp parallel copyin (l) // expected-error {{'operator=' is a private member of 'S4'}}
68 #pragma omp parallel copyin (S1) // expected-error {{'S1' does not refer to a value}}
69 #pragma omp parallel copyin (argv[1]) // expected-error {{expected variable name}}
70 #pragma omp parallel copyin(i) // expected-error {{copyin variable must be threadprivate}}
71 #pragma omp parallel copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
72 #pragma omp parallel copyin(ST<int>::s) // expected-error {{copyin variable must be threadprivate}}
73 #pragma omp parallel copyin(B::x)
74 foo();
76 return 0;