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