1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
6 struct S1
; // expected-note 2 {{declared here}} // expected-note 2 {{forward declaration of 'S1'}}
12 S2(S2
&s2
):a(s2
.a
) { }
20 S3(S3
&s3
):a(s3
.a
) { }
35 S5(const S5
&s5
):a(s5
.a
) { }
41 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
45 #pragma omp threadprivate(x) // expected-note 2 {{defined as threadprivate or thread local}}
51 template <class T
, typename S
, int N
>
52 T
tmain(T argc
, S
**argv
) {
54 const int da
[5] = { 0 };
64 #pragma omp distribute parallel for simd shared // expected-error {{expected '(' after 'shared'}}
65 for(int k
= 0 ; k
< n
; k
++) {
71 #pragma omp distribute parallel for simd shared ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
72 for(int k
= 0 ; k
< n
; k
++) {
78 #pragma omp distribute parallel for simd shared () // expected-error {{expected expression}}
79 for(int k
= 0 ; k
< n
; k
++) {
85 #pragma omp distribute parallel for simd shared (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
86 for(int k
= 0 ; k
< n
; k
++) {
92 #pragma omp distribute parallel for simd shared (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
93 for(int k
= 0 ; k
< n
; k
++) {
99 #pragma omp distribute parallel for simd shared (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
100 for(int k
= 0 ; k
< n
; k
++) {
106 #pragma omp distribute parallel for simd shared (argc, z)
107 for(int k
= 0 ; k
< n
; k
++) {
113 #pragma omp distribute parallel for simd shared (S1) // expected-error {{'S1' does not refer to a value}}
114 for(int k
= 0 ; k
< n
; k
++) {
120 #pragma omp distribute parallel for simd shared (a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-warning {{type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{type 'const S3' is not trivially copyable and not guaranteed to be mapped correctly}}
121 for(int k
= 0 ; k
< n
; k
++) {
127 #pragma omp distribute parallel for simd shared (argv[1]) // expected-error {{expected variable name}}
128 for(int k
= 0 ; k
< n
; k
++) {
134 #pragma omp distribute parallel for simd shared(ba) // expected-warning {{type 'const S2[5]' is not trivially copyable and not guaranteed to be mapped correctly}}
135 for(int k
= 0 ; k
< n
; k
++) {
141 #pragma omp distribute parallel for simd shared(ca) // expected-warning {{type 'const S3[5]' is not trivially copyable and not guaranteed to be mapped correctly}}
142 for(int k
= 0 ; k
< n
; k
++) {
148 #pragma omp distribute parallel for simd shared(da)
149 for(int k
= 0 ; k
< n
; k
++) {
155 #pragma omp distribute parallel for simd shared(e, g) // expected-warning {{type 'S4' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
156 for(int k
= 0 ; k
< n
; k
++) {
162 #pragma omp distribute parallel for simd shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
163 for(int k
= 0 ; k
< n
; k
++) {
169 #pragma omp distribute parallel for simd private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}}
170 for(int k
= 0 ; k
< n
; k
++) {
176 #pragma omp distribute parallel for simd firstprivate(i), shared(i) // expected-error {{firstprivate variable cannot be shared}} expected-note {{defined as firstprivate}}
177 for(int k
= 0 ; k
< n
; k
++) {
183 #pragma omp distribute parallel for simd private(i)
184 for(int k
= 0 ; k
< n
; k
++) {
190 #pragma omp distribute parallel for simd shared(i)
191 for(int k
= 0 ; k
< n
; k
++) {
197 #pragma omp distribute parallel for simd shared(j)
198 for(int k
= 0 ; k
< n
; k
++) {
204 #pragma omp distribute parallel for simd firstprivate(i)
205 for(int k
= 0 ; k
< n
; k
++) {
211 #pragma omp distribute parallel for simd shared(i)
212 for(int k
= 0 ; k
< n
; k
++) {
218 #pragma omp distribute parallel for simd shared(j)
219 for(int k
= 0 ; k
< n
; k
++) {
226 int main(int argc
, char **argv
) {
228 const int da
[5] = { 0 };
238 #pragma omp distribute parallel for simd shared // expected-error {{expected '(' after 'shared'}}
239 for(int k
= 0 ; k
< n
; k
++) {
245 #pragma omp distribute parallel for simd shared ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
246 for(int k
= 0 ; k
< n
; k
++) {
252 #pragma omp distribute parallel for simd shared () // expected-error {{expected expression}}
253 for(int k
= 0 ; k
< n
; k
++) {
259 #pragma omp distribute parallel for simd shared (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
260 for(int k
= 0 ; k
< n
; k
++) {
266 #pragma omp distribute parallel for simd shared (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
267 for(int k
= 0 ; k
< n
; k
++) {
273 #pragma omp distribute parallel for simd shared (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
274 for(int k
= 0 ; k
< n
; k
++) {
280 #pragma omp distribute parallel for simd shared (argc, z)
281 for(int k
= 0 ; k
< n
; k
++) {
287 #pragma omp distribute parallel for simd shared (S1) // expected-error {{'S1' does not refer to a value}}
288 for(int k
= 0 ; k
< n
; k
++) {
294 #pragma omp distribute parallel for simd shared (a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-warning {{type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{type 'const S3' is not trivially copyable and not guaranteed to be mapped correctly}}
295 for(int k
= 0 ; k
< n
; k
++) {
301 #pragma omp distribute parallel for simd shared (argv[1]) // expected-error {{expected variable name}}
302 for(int k
= 0 ; k
< n
; k
++) {
308 #pragma omp distribute parallel for simd shared(ba) // expected-warning {{type 'const S2[5]' is not trivially copyable and not guaranteed to be mapped correctly}}
309 for(int k
= 0 ; k
< n
; k
++) {
315 #pragma omp distribute parallel for simd shared(ca) // expected-warning {{type 'const S3[5]' is not trivially copyable and not guaranteed to be mapped correctly}}
316 for(int k
= 0 ; k
< n
; k
++) {
322 #pragma omp distribute parallel for simd shared(da)
323 for(int k
= 0 ; k
< n
; k
++) {
329 #pragma omp distribute parallel for simd shared(e, g) // expected-warning {{type 'S4' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
330 for(int k
= 0 ; k
< n
; k
++) {
336 #pragma omp distribute parallel for simd shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
337 for(int k
= 0 ; k
< n
; k
++) {
343 #pragma omp distribute parallel for simd private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}}
344 for(int k
= 0 ; k
< n
; k
++) {
350 #pragma omp distribute parallel for simd firstprivate(i), shared(i) // expected-error {{firstprivate variable cannot be shared}} expected-note {{defined as firstprivate}}
351 for(int k
= 0 ; k
< n
; k
++) {
357 #pragma omp distribute parallel for simd private(i)
358 for(int k
= 0 ; k
< n
; k
++) {
364 #pragma omp distribute parallel for simd shared(i)
365 for(int k
= 0 ; k
< n
; k
++) {
371 #pragma omp distribute parallel for simd shared(j)
372 for(int k
= 0 ; k
< n
; k
++) {
378 #pragma omp distribute parallel for simd firstprivate(i)
379 for(int k
= 0 ; k
< n
; k
++) {
385 #pragma omp distribute parallel for simd shared(i)
386 for(int k
= 0 ; k
< n
; k
++) {
392 #pragma omp distribute parallel for simd shared(j)
393 for(int k
= 0 ; k
< n
; k
++) {
397 return tmain
<int, char, 1000>(argc
, argv
); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 1000>' requested here}}