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