11c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
21c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
31c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
4*ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -ferror-limit 150 -o - %s -Wuninitialized
5*ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
6*ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
7b8552abfSAlexey Bataev 
81c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
91c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
101c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
11*ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -ferror-limit 150 -o - %s -Wuninitialized
12*ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
13*ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
14b8552abfSAlexey Bataev 
15b8552abfSAlexey Bataev typedef void **omp_allocator_handle_t;
168026394dSAlexey Bataev extern const omp_allocator_handle_t omp_null_allocator;
17b8552abfSAlexey Bataev extern const omp_allocator_handle_t omp_default_mem_alloc;
18b8552abfSAlexey Bataev extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
19b8552abfSAlexey Bataev extern const omp_allocator_handle_t omp_const_mem_alloc;
20b8552abfSAlexey Bataev extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
21b8552abfSAlexey Bataev extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
22b8552abfSAlexey Bataev extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
23b8552abfSAlexey Bataev extern const omp_allocator_handle_t omp_pteam_mem_alloc;
24b8552abfSAlexey Bataev extern const omp_allocator_handle_t omp_thread_mem_alloc;
25b8552abfSAlexey Bataev 
26b8552abfSAlexey Bataev void xxx(int argc) {
27b8552abfSAlexey Bataev   int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
28b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
29b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
30b8552abfSAlexey Bataev     ;
31b8552abfSAlexey Bataev }
32b8552abfSAlexey Bataev 
33b8552abfSAlexey Bataev void foo() {
34b8552abfSAlexey Bataev }
35b8552abfSAlexey Bataev 
36b8552abfSAlexey Bataev bool foobool(int argc) {
37b8552abfSAlexey Bataev   return argc;
38b8552abfSAlexey Bataev }
39b8552abfSAlexey Bataev 
40b8552abfSAlexey Bataev void foobar(int &ref) {
41b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+:ref)
42b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
43b8552abfSAlexey Bataev     foo();
44b8552abfSAlexey Bataev }
45b8552abfSAlexey Bataev 
46b8552abfSAlexey Bataev struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
47b8552abfSAlexey Bataev extern S1 a;
48b8552abfSAlexey Bataev class S2 {
49b8552abfSAlexey Bataev   mutable int a;
50b8552abfSAlexey Bataev   S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}}
51b8552abfSAlexey Bataev 
52b8552abfSAlexey Bataev public:
53b8552abfSAlexey Bataev   S2() : a(0) {}
54b8552abfSAlexey Bataev   S2(S2 &s2) : a(s2.a) {}
55b8552abfSAlexey Bataev   static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
56b8552abfSAlexey Bataev   static const float S2sc; // expected-note 2 {{'S2sc' declared here}}
57b8552abfSAlexey Bataev };
58b8552abfSAlexey Bataev const float S2::S2sc = 0;
59b8552abfSAlexey Bataev S2 b;                     // expected-note 3 {{'b' defined here}}
60b8552abfSAlexey Bataev const S2 ba[5];           // expected-note 2 {{'ba' defined here}}
61b8552abfSAlexey Bataev class S3 {
62b8552abfSAlexey Bataev   int a;
63b8552abfSAlexey Bataev 
64b8552abfSAlexey Bataev public:
65b8552abfSAlexey Bataev   int b;
66b8552abfSAlexey Bataev   S3() : a(0) {}
67b8552abfSAlexey Bataev   S3(const S3 &s3) : a(s3.a) {}
68b8552abfSAlexey Bataev   S3 operator+(const S3 &arg1) { return arg1; }
69b8552abfSAlexey Bataev };
70b8552abfSAlexey Bataev int operator+(const S3 &arg1, const S3 &arg2) { return 5; }
71b8552abfSAlexey Bataev S3 c;               // expected-note 3 {{'c' defined here}}
72b8552abfSAlexey Bataev const S3 ca[5];     // expected-note 2 {{'ca' defined here}}
73b8552abfSAlexey Bataev extern const int f; // expected-note 4 {{'f' declared here}}
74b8552abfSAlexey Bataev class S4 {
75b8552abfSAlexey Bataev   int a;
76b8552abfSAlexey Bataev   S4(); // expected-note {{implicitly declared private here}}
77b8552abfSAlexey Bataev   S4(const S4 &s4);
78b8552abfSAlexey Bataev   S4 &operator+(const S4 &arg) { return (*this); }
79b8552abfSAlexey Bataev 
80b8552abfSAlexey Bataev public:
81b8552abfSAlexey Bataev   S4(int v) : a(v) {}
82b8552abfSAlexey Bataev };
83b8552abfSAlexey Bataev S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
84b8552abfSAlexey Bataev class S5 {
85b8552abfSAlexey Bataev   int a;
86b8552abfSAlexey Bataev   S5() : a(0) {} // expected-note {{implicitly declared private here}}
87b8552abfSAlexey Bataev   S5(const S5 &s5) : a(s5.a) {}
88b8552abfSAlexey Bataev   S5 &operator+(const S5 &arg);
89b8552abfSAlexey Bataev 
90b8552abfSAlexey Bataev public:
91b8552abfSAlexey Bataev   S5(int v) : a(v) {}
92b8552abfSAlexey Bataev };
93b8552abfSAlexey Bataev 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}}
94b8552abfSAlexey Bataev #if __cplusplus >= 201103L // C++11 or later
95b8552abfSAlexey Bataev // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}}
96b8552abfSAlexey Bataev #endif
97b8552abfSAlexey Bataev   int a;
98b8552abfSAlexey Bataev 
99b8552abfSAlexey Bataev public:
100b8552abfSAlexey Bataev   S6() : a(6) {}
101b8552abfSAlexey Bataev   operator int() { return 6; }
102b8552abfSAlexey Bataev } o;
103b8552abfSAlexey Bataev 
104b8552abfSAlexey Bataev struct S7 {
105b8552abfSAlexey Bataev   int a: 32;
106b8552abfSAlexey Bataev   S7() {
107b8552abfSAlexey Bataev #pragma omp taskloop reduction(+:a) // expected-error {{expected addressable reduction item for the task-based directives}}
108b8552abfSAlexey Bataev     for (int i = 0; i < 10; ++i)
109b8552abfSAlexey Bataev       ++a;
110b8552abfSAlexey Bataev   }
111b8552abfSAlexey Bataev };
112b8552abfSAlexey Bataev 
113b8552abfSAlexey Bataev S3 h, k;
114b8552abfSAlexey Bataev #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
115b8552abfSAlexey Bataev 
116b8552abfSAlexey Bataev template <class T>       // expected-note {{declared here}}
117b8552abfSAlexey Bataev T tmain(T argc) {
118b8552abfSAlexey Bataev   const T d = T();       // expected-note 4 {{'d' defined here}}
119b8552abfSAlexey Bataev   const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
120b8552abfSAlexey Bataev   T qa[5] = {T()};
121b8552abfSAlexey Bataev   T i, z;
122b8552abfSAlexey Bataev   T &j = i;                        // expected-note 4 {{'j' defined here}}
123b8552abfSAlexey Bataev   S3 &p = k;                       // expected-note 2 {{'p' defined here}}
124b8552abfSAlexey Bataev   const T &r = da[(int)i];         // expected-note 2 {{'r' defined here}}
125b8552abfSAlexey Bataev   T &q = qa[(int)i];               // expected-note 2 {{'q' defined here}}
126b8552abfSAlexey Bataev   T fl;
127b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction // expected-error {{expected '(' after 'reduction'}}
128b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
129b8552abfSAlexey Bataev     foo();
130b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp master taskloop simd' are ignored}}
131b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
132b8552abfSAlexey Bataev     foo();
133b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
134b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
135b8552abfSAlexey Bataev     foo();
136b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
137b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
138b8552abfSAlexey Bataev     foo();
139b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
140b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
141b8552abfSAlexey Bataev     foo();
142b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
143b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
144b8552abfSAlexey Bataev     foo();
145b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
146b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
147b8552abfSAlexey Bataev     foo();
148b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
149b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
150b8552abfSAlexey Bataev     foo();
151b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
152b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
153b8552abfSAlexey Bataev     foo();
154b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
155b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
156b8552abfSAlexey Bataev     foo();
157b8552abfSAlexey Bataev #pragma omp master taskloop simd 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'}}
158b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
159b8552abfSAlexey Bataev     foo();
160b8552abfSAlexey Bataev #pragma omp master taskloop simd 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 '('}}
161b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
162b8552abfSAlexey Bataev     foo();
163b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(^ : T) // expected-error {{'T' does not refer to a value}}
164b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
165b8552abfSAlexey Bataev     foo();
166b8552abfSAlexey Bataev #pragma omp master taskloop simd 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'}}
167b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
168b8552abfSAlexey Bataev     foo();
169b8552abfSAlexey Bataev #pragma omp master taskloop simd 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}}
170b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
171b8552abfSAlexey Bataev     foo();
172b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
173b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
174b8552abfSAlexey Bataev     foo();
175b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
176b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
177b8552abfSAlexey Bataev     foo();
178b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(* : z, ca) // expected-error {{const-qualified variable cannot be reduction}}
179b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
180b8552abfSAlexey Bataev     foo();
181b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
182b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
183b8552abfSAlexey Bataev     foo();
184b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
185b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
186b8552abfSAlexey Bataev     foo();
187b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
188b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
189b8552abfSAlexey Bataev     foo();
190b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
191b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
192b8552abfSAlexey Bataev     foo();
193b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
194b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
195b8552abfSAlexey Bataev     foo();
196b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
197b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
198b8552abfSAlexey Bataev     foo();
199b8552abfSAlexey Bataev #pragma omp master taskloop simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
200b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
201b8552abfSAlexey Bataev     foo();
202b8552abfSAlexey Bataev #pragma omp parallel private(k)
203b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
204b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
205b8552abfSAlexey Bataev     foo();
206b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}}
207b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
208b8552abfSAlexey Bataev     foo();
209b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
210b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
211b8552abfSAlexey Bataev     foo();
212b8552abfSAlexey Bataev #pragma omp parallel shared(i)
213b8552abfSAlexey Bataev #pragma omp parallel reduction(min : i)
214b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
215b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
216b8552abfSAlexey Bataev     foo();
217b8552abfSAlexey Bataev #pragma omp parallel private(fl)
218b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'master taskloop simd' directive}}
219b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
220b8552abfSAlexey Bataev     foo();
221b8552abfSAlexey Bataev #pragma omp parallel reduction(* : fl)
222b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : fl)
223b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
224b8552abfSAlexey Bataev     foo();
225b8552abfSAlexey Bataev 
226b8552abfSAlexey Bataev   return T();
227b8552abfSAlexey Bataev }
228b8552abfSAlexey Bataev 
229b8552abfSAlexey Bataev namespace A {
230b8552abfSAlexey Bataev double x;
231b8552abfSAlexey Bataev #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
232b8552abfSAlexey Bataev }
233b8552abfSAlexey Bataev namespace B {
234b8552abfSAlexey Bataev using A::x;
235b8552abfSAlexey Bataev }
236b8552abfSAlexey Bataev 
237b8552abfSAlexey Bataev int main(int argc, char **argv) {
238b8552abfSAlexey Bataev   const int d = 5;       // expected-note 2 {{'d' defined here}}
239b8552abfSAlexey Bataev   const int da[5] = {0}; // expected-note {{'da' defined here}}
240b8552abfSAlexey Bataev   int qa[5] = {0};
241b8552abfSAlexey Bataev   S4 e(4);
242b8552abfSAlexey Bataev   S5 g(5);
243b8552abfSAlexey Bataev   int i, z;
244b8552abfSAlexey Bataev   int &j = i;                      // expected-note 2 {{'j' defined here}}
245b8552abfSAlexey Bataev   S3 &p = k;                       // expected-note 2 {{'p' defined here}}
246b8552abfSAlexey Bataev   const int &r = da[i];            // expected-note {{'r' defined here}}
247b8552abfSAlexey Bataev   int &q = qa[i];                  // expected-note {{'q' defined here}}
248b8552abfSAlexey Bataev   float fl;
249b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction // expected-error {{expected '(' after 'reduction'}}
250b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
251b8552abfSAlexey Bataev     foo();
252b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp master taskloop simd' are ignored}}
253b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
254b8552abfSAlexey Bataev     foo();
255b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
256b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
257b8552abfSAlexey Bataev     foo();
258b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
259b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
260b8552abfSAlexey Bataev     foo();
261b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
262b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
263b8552abfSAlexey Bataev     foo();
264b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
265b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
266b8552abfSAlexey Bataev     foo();
267b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
268b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
269b8552abfSAlexey Bataev     foo();
270b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
271b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
272b8552abfSAlexey Bataev     foo();
273b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
274b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
275b8552abfSAlexey Bataev     foo();
276b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
277b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
278b8552abfSAlexey Bataev     foo();
279b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(~ : argc) // expected-error {{expected unqualified-id}}
280b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
281b8552abfSAlexey Bataev     foo();
282b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(&& : argc, z)
283b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
284b8552abfSAlexey Bataev     foo();
285b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
286b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
287b8552abfSAlexey Bataev     foo();
288b8552abfSAlexey Bataev #pragma omp master taskloop simd 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'}}
289b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
290b8552abfSAlexey Bataev     foo();
291b8552abfSAlexey Bataev #pragma omp master taskloop simd 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}}
292b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
293b8552abfSAlexey Bataev     foo();
294b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
295b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
296b8552abfSAlexey Bataev     foo();
297b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
298b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
299b8552abfSAlexey Bataev     foo();
300b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
301b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
302b8552abfSAlexey Bataev     foo();
303b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
304b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
305b8552abfSAlexey Bataev     foo();
306b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
307b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
308b8552abfSAlexey Bataev     foo();
309b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
310b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
311b8552abfSAlexey Bataev     foo();
312b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
313b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
314b8552abfSAlexey Bataev     foo();
315b8552abfSAlexey Bataev #pragma omp master taskloop simd 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')}}
316b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
317b8552abfSAlexey Bataev     foo();
318b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
319b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
320b8552abfSAlexey Bataev     foo();
321b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : o) // expected-error {{no viable overloaded '='}}
322b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
323b8552abfSAlexey Bataev     foo();
324b8552abfSAlexey Bataev #pragma omp master taskloop simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
325b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
326b8552abfSAlexey Bataev     foo();
327b8552abfSAlexey Bataev #pragma omp parallel private(k)
328b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
329b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
330b8552abfSAlexey Bataev     foo();
331b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
332b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
333b8552abfSAlexey Bataev     foo();
334b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
335b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
336b8552abfSAlexey Bataev     foo();
337b8552abfSAlexey Bataev #pragma omp parallel shared(i)
338b8552abfSAlexey Bataev #pragma omp parallel reduction(min : i)
339b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
340b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
341b8552abfSAlexey Bataev     foo();
342b8552abfSAlexey Bataev #pragma omp parallel private(fl)
343b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : fl)
344b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
345b8552abfSAlexey Bataev     foo();
346b8552abfSAlexey Bataev #pragma omp parallel reduction(* : fl)
347b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : fl)
348b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
349b8552abfSAlexey Bataev     foo();
350b8552abfSAlexey Bataev   static int m;
351b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : m) // OK
352b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
353b8552abfSAlexey Bataev     m++;
354b8552abfSAlexey Bataev #pragma omp master taskloop simd reduction(+ : m) nogroup // expected-error {{'reduction' clause cannot be used with 'nogroup' clause}}
355b8552abfSAlexey Bataev   for (int i = 0; i < 10; ++i)
356b8552abfSAlexey Bataev     m++;
3571c1d9d9dSAlexey Bataev #pragma omp master taskloop simd reduction(task, + : m) // omp45-error 2 {{expected expression}} omp45-warning {{missing ':' after reduction identifier - ignoring}} omp50-error {{'reduction' clause with 'task' modifier allowed only on non-simd parallel or worksharing constructs}}
3581c1d9d9dSAlexey Bataev   for (int i = 0; i < 10; ++i)
3591c1d9d9dSAlexey Bataev     m++;
360b8552abfSAlexey Bataev 
361b8552abfSAlexey Bataev   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}}
362b8552abfSAlexey Bataev }
363