[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / teams_distribute_parallel_for_copyin_messages.cpp
blob1c18f855907795ed8fc7b0bc72033c0a2287b0bf
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;
16 public:
17 S2() : a(0) {}
18 S2 &operator=(S2 &s2) { return *this; }
20 class S3 {
21 int a;
23 public:
24 S3() : a(0) {}
25 S3 &operator=(S3 &s3) { return *this; }
27 class S4 {
28 int a;
29 S4();
30 S4 &operator=(const S4 &s4); // expected-note {{implicitly declared private here}}
32 public:
33 S4(int v) : a(v) {}
35 class S5 {
36 int a;
37 S5() : a(0) {}
38 S5 &operator=(const S5 &s5) { return *this; } // expected-note {{implicitly declared private here}}
40 public:
41 S5(int v) : a(v) {}
43 template <class T>
44 class ST {
45 public:
46 static T s;
49 S2 k;
50 S3 h;
51 S4 l(3);
52 S5 m(4);
53 #pragma omp threadprivate(h, k, l, m)
55 namespace A {
56 double x;
57 #pragma omp threadprivate(x)
59 namespace B {
60 using A::x;
63 int main(int argc, char **argv) {
64 int i;
65 #pragma omp target
66 #pragma omp teams distribute parallel for copyin // expected-error {{expected '(' after 'copyin'}}
67 for (i = 0; i < argc; ++i)
68 foo();
69 #pragma omp target
70 #pragma omp teams distribute parallel for copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
71 for (i = 0; i < argc; ++i)
72 foo();
73 #pragma omp target
74 #pragma omp teams distribute parallel for copyin() // expected-error {{expected expression}}
75 for (i = 0; i < argc; ++i)
76 foo();
77 #pragma omp target
78 #pragma omp teams distribute parallel for copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}
79 for (i = 0; i < argc; ++i)
80 foo();
81 #pragma omp target
82 #pragma omp teams distribute parallel for copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
83 for (i = 0; i < argc; ++i)
84 foo();
85 #pragma omp target
86 #pragma omp teams distribute parallel for copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
87 for (i = 0; i < argc; ++i)
88 foo();
89 #pragma omp target
90 #pragma omp teams distribute parallel for copyin(l) // expected-error {{'operator=' is a private member of 'S4'}}
91 for (i = 0; i < argc; ++i)
92 foo();
93 #pragma omp target
94 #pragma omp teams distribute parallel for copyin(S1) // expected-error {{'S1' does not refer to a value}}
95 for (i = 0; i < argc; ++i)
96 foo();
97 #pragma omp target
98 #pragma omp teams distribute parallel for copyin(argv[1]) // expected-error {{expected variable name}}
99 for (i = 0; i < argc; ++i)
100 foo();
101 #pragma omp target
102 #pragma omp teams distribute parallel for copyin(i) // expected-error {{copyin variable must be threadprivate}}
103 for (i = 0; i < argc; ++i)
104 foo();
105 #pragma omp target
106 #pragma omp teams distribute parallel for copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
107 for (i = 0; i < argc; ++i)
108 foo();
109 #pragma omp target
110 #pragma omp teams distribute parallel for copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}}
111 for (i = 0; i < argc; ++i)
112 foo();
114 return 0;