1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -ferror-limit 150 -o - %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
6 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
7 
8 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
9 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
10 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
11 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -ferror-limit 150 -o - %s -Wuninitialized
12 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
13 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
14 
15 extern int omp_default_mem_alloc;
16 
xxx(int argc)17 void xxx(int argc) {
18   int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
19 #pragma omp distribute parallel for reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
20   for (int i = 0; i < 10; ++i)
21     ;
22 }
23 
foo()24 void foo() {
25 }
26 
foobool(int argc)27 bool foobool(int argc) {
28   return argc;
29 }
30 
foobar(int & ref)31 void foobar(int &ref) {
32 #pragma omp target
33 #pragma omp teams
34 #pragma omp distribute parallel for reduction(+:ref)
35   for (int i = 0; i < 10; ++i)
36     foo();
37 }
38 
39 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
40 extern S1 a;
41 class S2 {
42   mutable int a;
operator +(const S2 & arg)43   S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}}
44 
45 public:
S2()46   S2() : a(0) {}
S2(S2 & s2)47   S2(S2 &s2) : a(s2.a) {}
48   static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
49   static const float S2sc; // expected-note 2 {{'S2sc' declared here}}
50 };
51 const float S2::S2sc = 0;
52 S2 b;                     // expected-note 3 {{'b' defined here}}
53 const S2 ba[5];           // expected-note 2 {{'ba' defined here}}
54 class S3 {
55   int a;
56 
57 public:
58   int b;
S3()59   S3() : a(0) {}
S3(const S3 & s3)60   S3(const S3 &s3) : a(s3.a) {}
operator +(const S3 & arg1)61   S3 operator+(const S3 &arg1) { return arg1; }
62 };
operator +(const S3 & arg1,const S3 & arg2)63 int operator+(const S3 &arg1, const S3 &arg2) { return 5; }
64 S3 c;               // expected-note 3 {{'c' defined here}}
65 const S3 ca[5];     // expected-note 2 {{'ca' defined here}}
66 extern const int f; // expected-note 4 {{'f' declared here}}
67 class S4 {
68   int a;
69   S4(); // expected-note {{implicitly declared private here}}
70   S4(const S4 &s4);
operator +(const S4 & arg)71   S4 &operator+(const S4 &arg) { return (*this); }
72 
73 public:
S4(int v)74   S4(int v) : a(v) {}
75 };
operator &=(S4 & arg1,S4 & arg2)76 S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
77 class S5 {
78   int a;
S5()79   S5() : a(0) {} // expected-note {{implicitly declared private here}}
S5(const S5 & s5)80   S5(const S5 &s5) : a(s5.a) {}
81   S5 &operator+(const S5 &arg);
82 
83 public:
S5(int v)84   S5(int v) : a(v) {}
85 };
86 class S6 { // expected-note 3 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}}
87 #if __cplusplus >= 201103L // C++11 or later
88 // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}}
89 #endif
90   int a;
91 
92 public:
S6()93   S6() : a(6) {}
operator int()94   operator int() { return 6; }
95 } o;
96 
97 S3 h, k;
98 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
99 
100 template <class T>       // expected-note {{declared here}}
tmain(T argc)101 T tmain(T argc) {
102   const T d = T();       // expected-note 4 {{'d' defined here}}
103   const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
104   T qa[5] = {T()};
105   T i, z;
106   T &j = i;                        // expected-note 4 {{'j' defined here}}
107   S3 &p = k;                       // expected-note 2 {{'p' defined here}}
108   const T &r = da[(int)i];         // expected-note 2 {{'r' defined here}}
109   T &q = qa[(int)i];               // expected-note 2 {{'q' defined here}}
110   T fl;
111 #pragma omp target
112 #pragma omp teams
113 #pragma omp distribute parallel for reduction // expected-error {{expected '(' after 'reduction'}}
114   for (int i = 0; i < 10; ++i)
115     foo();
116 #pragma omp target
117 #pragma omp teams
118 #pragma omp distribute parallel for reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
119   for (int i = 0; i < 10; ++i)
120     foo();
121 #pragma omp target
122 #pragma omp teams
123 #pragma omp distribute parallel for reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
124   for (int i = 0; i < 10; ++i)
125     foo();
126 #pragma omp target
127 #pragma omp teams
128 #pragma omp distribute parallel for reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
129   for (int i = 0; i < 10; ++i)
130     foo();
131 #pragma omp target
132 #pragma omp teams
133 #pragma omp distribute parallel for reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
134   for (int i = 0; i < 10; ++i)
135     foo();
136 #pragma omp target
137 #pragma omp teams
138 #pragma omp distribute parallel for reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
139   for (int i = 0; i < 10; ++i)
140     foo();
141 #pragma omp target
142 #pragma omp teams
143 #pragma omp distribute parallel for reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
144   for (int i = 0; i < 10; ++i)
145     foo();
146 #pragma omp target
147 #pragma omp teams
148 #pragma omp distribute parallel for reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
149   for (int i = 0; i < 10; ++i)
150     foo();
151 #pragma omp target
152 #pragma omp teams
153 #pragma omp distribute parallel for reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
154   for (int i = 0; i < 10; ++i)
155     foo();
156 #pragma omp target
157 #pragma omp teams
158 #pragma omp distribute parallel for reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
159   for (int i = 0; i < 10; ++i)
160     foo();
161 #pragma omp target
162 #pragma omp teams
163 #pragma omp distribute parallel for reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}}
164   for (int i = 0; i < 10; ++i)
165     foo();
166 #pragma omp target
167 #pragma omp teams
168 #pragma omp distribute parallel for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
169   for (int i = 0; i < 10; ++i)
170     foo();
171 #pragma omp target
172 #pragma omp teams
173 #pragma omp distribute parallel for reduction(^ : T) // expected-error {{'T' does not refer to a value}}
174   for (int i = 0; i < 10; ++i)
175     foo();
176 #pragma omp target
177 #pragma omp teams
178 #pragma omp distribute parallel for reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 3 {{const-qualified variable cannot be reduction}} expected-error 2 {{'operator+' is a private member of 'S2'}} expected-warning 2 {{Type 'S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning 2 {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
179   for (int i = 0; i < 10; ++i)
180     foo();
181 #pragma omp target
182 #pragma omp teams
183 #pragma omp distribute parallel for reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 4 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified variable cannot be reduction}}
184   for (int i = 0; i < 10; ++i)
185     foo();
186 #pragma omp target
187 #pragma omp teams
188 #pragma omp distribute parallel for reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
189   for (int i = 0; i < 10; ++i)
190     foo();
191 #pragma omp target
192 #pragma omp teams
193 #pragma omp distribute parallel for reduction(+ : ba, z) // expected-error {{const-qualified variable cannot be reduction}}
194   for (int i = 0; i < 10; ++i)
195     foo();
196 #pragma omp target
197 #pragma omp teams
198 #pragma omp distribute parallel for reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
199   for (int i = 0; i < 10; ++i)
200     foo();
201 #pragma omp target
202 #pragma omp teams
203 #pragma omp distribute parallel for reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
204   for (int i = 0; i < 10; ++i)
205     foo();
206 #pragma omp target
207 #pragma omp teams
208 #pragma omp distribute parallel for reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
209   for (int i = 0; i < 10; ++i)
210     foo();
211 #pragma omp target
212 #pragma omp teams
213 #pragma omp distribute parallel for reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
214   for (int i = 0; i < 10; ++i)
215     foo();
216 #pragma omp target
217 #pragma omp teams
218 #pragma omp distribute parallel for reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
219   for (int i = 0; i < 10; ++i)
220     foo();
221 #pragma omp target
222 #pragma omp teams
223 #pragma omp distribute parallel for reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} expected-warning 2 {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
224   for (int i = 0; i < 10; ++i)
225     foo();
226 #pragma omp target
227 #pragma omp teams
228 #pragma omp distribute parallel for reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
229   for (int i = 0; i < 10; ++i)
230     foo();
231 #pragma omp target
232 #pragma omp teams
233 #pragma omp distribute parallel for private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
234   for (int i = 0; i < 10; ++i)
235     foo();
236 #pragma omp parallel private(k)
237 #pragma omp target
238 #pragma omp teams
239 #pragma omp distribute parallel for reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
240   for (int i = 0; i < 10; ++i)
241     foo();
242 #pragma omp target
243 #pragma omp teams
244 #pragma omp distribute parallel for reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}}
245   for (int i = 0; i < 10; ++i)
246     foo();
247 #pragma omp target
248 #pragma omp teams
249 #pragma omp distribute parallel for reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
250   for (int i = 0; i < 10; ++i)
251     foo();
252 #pragma omp parallel shared(i)
253 #pragma omp parallel reduction(min : i)
254 #pragma omp target
255 #pragma omp teams
256 #pragma omp distribute parallel for reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
257   for (int i = 0; i < 10; ++i)
258     foo();
259 #pragma omp parallel private(fl)
260 #pragma omp target
261 #pragma omp teams
262 #pragma omp distribute parallel for reduction(+ : fl)
263   for (int i = 0; i < 10; ++i)
264     foo();
265 #pragma omp parallel reduction(* : fl)
266 #pragma omp target
267 #pragma omp teams
268 #pragma omp distribute parallel for reduction(+ : fl)
269   for (int i = 0; i < 10; ++i)
270     foo();
271 
272   return T();
273 }
274 
275 namespace A {
276 double x;
277 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
278 }
279 namespace B {
280 using A::x;
281 }
282 
main(int argc,char ** argv)283 int main(int argc, char **argv) {
284   const int d = 5;       // expected-note 2 {{'d' defined here}}
285   const int da[5] = {0}; // expected-note {{'da' defined here}}
286   int qa[5] = {0};
287   S4 e(4);
288   S5 g(5);
289   int i, z;
290   int &j = i;                      // expected-note 2 {{'j' defined here}}
291   S3 &p = k;                       // expected-note 2 {{'p' defined here}}
292   const int &r = da[i];            // expected-note {{'r' defined here}}
293   int &q = qa[i];                  // expected-note {{'q' defined here}}
294   float fl;
295 #pragma omp target
296 #pragma omp teams
297 #pragma omp distribute parallel for reduction // expected-error {{expected '(' after 'reduction'}}
298   for (int i = 0; i < 10; ++i)
299     foo();
300 #pragma omp target
301 #pragma omp teams
302 #pragma omp distribute parallel for reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
303   for (int i = 0; i < 10; ++i)
304     foo();
305 #pragma omp target
306 #pragma omp teams
307 #pragma omp distribute parallel for reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
308   for (int i = 0; i < 10; ++i)
309     foo();
310 #pragma omp target
311 #pragma omp teams
312 #pragma omp distribute parallel for reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
313   for (int i = 0; i < 10; ++i)
314     foo();
315 #pragma omp target
316 #pragma omp teams
317 #pragma omp distribute parallel for reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
318   for (int i = 0; i < 10; ++i)
319     foo();
320 #pragma omp target
321 #pragma omp teams
322 #pragma omp distribute parallel for reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
323   for (int i = 0; i < 10; ++i)
324     foo();
325 #pragma omp target
326 #pragma omp teams
327 #pragma omp distribute parallel for reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
328   for (int i = 0; i < 10; ++i)
329     foo();
330 #pragma omp target
331 #pragma omp teams
332 #pragma omp distribute parallel for reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
333   for (int i = 0; i < 10; ++i)
334     foo();
335 #pragma omp target
336 #pragma omp teams
337 #pragma omp distribute parallel for reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
338   for (int i = 0; i < 10; ++i)
339     foo();
340 #pragma omp target
341 #pragma omp teams
342 #pragma omp distribute parallel for reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
343   for (int i = 0; i < 10; ++i)
344     foo();
345 #pragma omp target
346 #pragma omp teams
347 #pragma omp distribute parallel for reduction(~ : argc) // expected-error {{expected unqualified-id}}
348   for (int i = 0; i < 10; ++i)
349     foo();
350 #pragma omp target
351 #pragma omp teams
352 #pragma omp distribute parallel for reduction(&& : argc)
353   for (int i = 0; i < 10; ++i)
354     foo();
355 #pragma omp target
356 #pragma omp teams
357 #pragma omp distribute parallel for reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
358   for (int i = 0; i < 10; ++i)
359     foo();
360 #pragma omp target
361 #pragma omp teams
362 #pragma omp distribute parallel for reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}} expected-warning {{Type 'S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
363   for (int i = 0; i < 10; ++i)
364     foo();
365 #pragma omp target
366 #pragma omp teams
367 #pragma omp distribute parallel for reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{incomplete type 'S1' where a complete type is required}} expected-warning {{Type 'S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
368   for (int i = 0; i < 10; ++i)
369     foo();
370 #pragma omp target
371 #pragma omp teams
372 #pragma omp distribute parallel for reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
373   for (int i = 0; i < 10; ++i)
374     foo();
375 #pragma omp target
376 #pragma omp teams
377 #pragma omp distribute parallel for reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}} expected-warning {{Type 'const S2 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
378   for (int i = 0; i < 10; ++i)
379     foo();
380 #pragma omp target
381 #pragma omp teams
382 #pragma omp distribute parallel for reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}} expected-warning {{Type 'const S3 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
383   for (int i = 0; i < 10; ++i)
384     foo();
385 #pragma omp target
386 #pragma omp teams
387 #pragma omp distribute parallel for reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
388   for (int i = 0; i < 10; ++i)
389     foo();
390 #pragma omp target
391 #pragma omp teams
392 #pragma omp distribute parallel for reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
393   for (int i = 0; i < 10; ++i)
394     foo();
395 #pragma omp target
396 #pragma omp teams
397 #pragma omp distribute parallel for reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
398   for (int i = 0; i < 10; ++i)
399     foo();
400 #pragma omp target
401 #pragma omp teams
402 #pragma omp distribute parallel for reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
403   for (int i = 0; i < 10; ++i)
404     foo();
405 #pragma omp target
406 #pragma omp teams
407 #pragma omp distribute parallel for reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}} 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}}
408   for (int i = 0; i < 10; ++i)
409     foo();
410 #pragma omp target
411 #pragma omp teams
412 #pragma omp distribute parallel for reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} expected-warning {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
413   for (int i = 0; i < 10; ++i)
414     foo();
415 #pragma omp target
416 #pragma omp teams
417 #pragma omp distribute parallel for reduction(+ : o) // expected-error {{no viable overloaded '='}}
418   for (int i = 0; i < 10; ++i)
419     foo();
420 #pragma omp target
421 #pragma omp teams
422 #pragma omp distribute parallel for private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
423   for (int i = 0; i < 10; ++i)
424     foo();
425 #pragma omp parallel private(k)
426 #pragma omp target
427 #pragma omp teams
428 #pragma omp distribute parallel for reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} expected-warning {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
429   for (int i = 0; i < 10; ++i)
430     foo();
431 #pragma omp target
432 #pragma omp teams
433 #pragma omp distribute parallel for reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}} expected-warning {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
434   for (int i = 0; i < 10; ++i)
435     foo();
436 #pragma omp target
437 #pragma omp teams
438 #pragma omp distribute parallel for reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
439   for (int i = 0; i < 10; ++i)
440     foo();
441 #pragma omp parallel shared(i)
442 #pragma omp parallel reduction(min : i)
443 #pragma omp target
444 #pragma omp teams
445 #pragma omp distribute parallel for reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
446   for (int i = 0; i < 10; ++i)
447     foo();
448 #pragma omp parallel private(fl)
449 #pragma omp target
450 #pragma omp teams
451 #pragma omp distribute parallel for reduction(+ : fl, z)
452   for (int i = 0; i < 10; ++i)
453     foo();
454 #pragma omp parallel reduction(* : fl)
455 #pragma omp target
456 #pragma omp teams
457 #pragma omp distribute parallel for reduction(+ : fl)
458   for (int i = 0; i < 10; ++i)
459     foo();
460   static int m;
461 #pragma omp target
462 #pragma omp teams
463 #pragma omp distribute parallel for reduction(+ : m) // OK
464   for (int i = 0; i < 10; ++i)
465     m++;
466 #pragma omp target
467 #pragma omp teams
468 #pragma omp distribute parallel for reduction(task, + : m) // omp45-error 2 {{expected expression}} omp45-warning {{missing ':' after reduction identifier - ignoring}}
469   for (int i = 0; i < 10; ++i)
470     m++;
471 
472   return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<float>' requested here}}
473 }
474