1 // RUN: %clang_cc1 -verify -fopenmp %s
3 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
26 #pragma omp target firstprivate(a) firstprivate(this->a)
27 for (int k = 0; k < v; ++k)
37 S5 &operator=(S5 &s) {
38 #pragma omp target firstprivate(a) firstprivate(this->a) firstprivate(s.a) // expected-error {{expected variable name or data member of current class}}
39 for (int k = 0; k < s.a; ++k)
52 #pragma omp target firstprivate(a) firstprivate(this->a)
53 for (int k = 0; k < v; ++k)
56 S6 &operator=(S6 &s) {
57 #pragma omp target firstprivate(a) firstprivate(this->a) firstprivate(s.a) // expected-error {{expected variable name or data member of current class}}
58 for (int k = 0; k < s.a; ++k)
71 #pragma omp target firstprivate(a) firstprivate(this->a) firstprivate(T::a)
72 for (int k = 0; k < a.a; ++k)
75 S7 &operator=(S7 &s) {
76 #pragma omp target firstprivate(a) firstprivate(this->a) firstprivate(s.a) firstprivate(s.T::a) // expected-error 2 {{expected variable name or data member of current class}}
77 for (int k = 0; k < s.a.a; ++k)
84 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
86 template <class I, class C>
87 int foomain(I argc, C **argv) {
92 #pragma omp target firstprivate // expected-error {{expected '(' after 'firstprivate'}}
94 #pragma omp target firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
96 #pragma omp target firstprivate() // expected-error {{expected expression}}
98 #pragma omp target firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
100 #pragma omp target firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
102 #pragma omp target firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
104 #pragma omp target firstprivate(argc)
106 #pragma omp target firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
108 #pragma omp target firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}}
110 #pragma omp target firstprivate(argv[1]) // expected-error {{expected variable name}}
112 #pragma omp target firstprivate(e, g)
114 #pragma omp target firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
116 #pragma omp target shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp target'}}
122 #pragma omp parallel shared(i)
123 #pragma omp parallel firstprivate(i)
124 #pragma omp target firstprivate(j)
126 #pragma omp target firstprivate(i)
133 #pragma omp target firstprivate(a)
139 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
145 int main(int argc, char **argv) {
148 S6<float> s6(0.0) , s6_0(1.0);
149 S7<S6<float> > s7(0.0) , s7_0(1.0);
152 #pragma omp target firstprivate // expected-error {{expected '(' after 'firstprivate'}}
154 #pragma omp target firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
156 #pragma omp target firstprivate() // expected-error {{expected expression}}
158 #pragma omp target firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
160 #pragma omp target firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
162 #pragma omp target firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
164 #pragma omp target firstprivate(argc)
166 #pragma omp target firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
168 #pragma omp target firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}}
170 #pragma omp target firstprivate(argv[1]) // expected-error {{expected variable name}}
172 #pragma omp target firstprivate(e, g)
174 #pragma omp target firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
176 #pragma omp target firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
178 #pragma omp target shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp target'}}
183 #pragma omp parallel shared(i)
184 #pragma omp parallel firstprivate(i)
185 #pragma omp target firstprivate(j)
187 #pragma omp target firstprivate(i)
190 #pragma omp target firstprivate(si) // OK
192 #pragma omp target map(i) firstprivate(i) // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target' directive}}
194 s6 = s6_0; // expected-note {{in instantiation of member function 'S6<float>::operator=' requested here}}
195 s7 = s7_0; // expected-note {{in instantiation of member function 'S7<S6<float> >::operator=' requested here}}
196 return foomain(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}