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
41c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 -ferror-limit 150 -o - %s -Wuninitialized
51c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
61c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
714a388f4SAlexey 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
111c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 -ferror-limit 150 -o - %s -Wuninitialized
121c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
131c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
1414a388f4SAlexey Bataev 
1514a388f4SAlexey Bataev typedef void **omp_allocator_handle_t;
168026394dSAlexey Bataev extern const omp_allocator_handle_t omp_null_allocator;
1714a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_default_mem_alloc;
1814a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
1914a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_const_mem_alloc;
2014a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
2114a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
2214a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
2314a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_pteam_mem_alloc;
2414a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_thread_mem_alloc;
2514a388f4SAlexey Bataev 
xxx(int argc)2614a388f4SAlexey Bataev void xxx(int argc) {
2714a388f4SAlexey Bataev   int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
2814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
2914a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
3014a388f4SAlexey Bataev     ;
3114a388f4SAlexey Bataev }
3214a388f4SAlexey Bataev 
foo()3314a388f4SAlexey Bataev void foo() {
3414a388f4SAlexey Bataev }
3514a388f4SAlexey Bataev 
foobool(int argc)3614a388f4SAlexey Bataev bool foobool(int argc) {
3714a388f4SAlexey Bataev   return argc;
3814a388f4SAlexey Bataev }
3914a388f4SAlexey Bataev 
foobar(int & ref)4014a388f4SAlexey Bataev void foobar(int &ref) {
4114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+:ref)
4214a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
4314a388f4SAlexey Bataev     foo();
4414a388f4SAlexey Bataev }
4514a388f4SAlexey Bataev 
4614a388f4SAlexey Bataev struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
4714a388f4SAlexey Bataev extern S1 a;
4814a388f4SAlexey Bataev class S2 {
4914a388f4SAlexey Bataev   mutable int a;
operator +(const S2 & arg)5014a388f4SAlexey Bataev   S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}}
5114a388f4SAlexey Bataev 
5214a388f4SAlexey Bataev public:
S2()5314a388f4SAlexey Bataev   S2() : a(0) {}
S2(S2 & s2)5414a388f4SAlexey Bataev   S2(S2 &s2) : a(s2.a) {}
5514a388f4SAlexey Bataev   static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
5614a388f4SAlexey Bataev   static const float S2sc; // expected-note 2 {{'S2sc' declared here}}
5714a388f4SAlexey Bataev };
5814a388f4SAlexey Bataev const float S2::S2sc = 0;
5914a388f4SAlexey Bataev S2 b;                     // expected-note 3 {{'b' defined here}}
6014a388f4SAlexey Bataev const S2 ba[5];           // expected-note 2 {{'ba' defined here}}
6114a388f4SAlexey Bataev class S3 {
6214a388f4SAlexey Bataev   int a;
6314a388f4SAlexey Bataev 
6414a388f4SAlexey Bataev public:
6514a388f4SAlexey Bataev   int b;
S3()6614a388f4SAlexey Bataev   S3() : a(0) {}
S3(const S3 & s3)6714a388f4SAlexey Bataev   S3(const S3 &s3) : a(s3.a) {}
operator +(const S3 & arg1)6814a388f4SAlexey Bataev   S3 operator+(const S3 &arg1) { return arg1; }
6914a388f4SAlexey Bataev };
operator +(const S3 & arg1,const S3 & arg2)7014a388f4SAlexey Bataev int operator+(const S3 &arg1, const S3 &arg2) { return 5; }
7114a388f4SAlexey Bataev S3 c;               // expected-note 3 {{'c' defined here}}
7214a388f4SAlexey Bataev const S3 ca[5];     // expected-note 2 {{'ca' defined here}}
7314a388f4SAlexey Bataev extern const int f; // expected-note 4 {{'f' declared here}}
7414a388f4SAlexey Bataev class S4 {
7514a388f4SAlexey Bataev   int a;
7614a388f4SAlexey Bataev   S4(); // expected-note {{implicitly declared private here}}
7714a388f4SAlexey Bataev   S4(const S4 &s4);
operator +(const S4 & arg)7814a388f4SAlexey Bataev   S4 &operator+(const S4 &arg) { return (*this); }
7914a388f4SAlexey Bataev 
8014a388f4SAlexey Bataev public:
S4(int v)8114a388f4SAlexey Bataev   S4(int v) : a(v) {}
8214a388f4SAlexey Bataev };
operator &=(S4 & arg1,S4 & arg2)8314a388f4SAlexey Bataev S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
8414a388f4SAlexey Bataev class S5 {
8514a388f4SAlexey Bataev   int a:32;
S5()8614a388f4SAlexey Bataev   S5() : a(0) {} // expected-note {{implicitly declared private here}}
S5(const S5 & s5)8714a388f4SAlexey Bataev   S5(const S5 &s5) : a(s5.a) {}
8814a388f4SAlexey Bataev   S5 &operator+(const S5 &arg);
8914a388f4SAlexey Bataev 
9014a388f4SAlexey Bataev public:
S5(int v)9114a388f4SAlexey Bataev   S5(int v) : a(v) {}
9214a388f4SAlexey Bataev };
9314a388f4SAlexey 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}}
9414a388f4SAlexey Bataev #if __cplusplus >= 201103L // C++11 or later
9514a388f4SAlexey Bataev // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}}
9614a388f4SAlexey Bataev #endif
9714a388f4SAlexey Bataev   int a;
9814a388f4SAlexey Bataev 
9914a388f4SAlexey Bataev public:
S6()10014a388f4SAlexey Bataev   S6() : a(6) {}
operator int()10114a388f4SAlexey Bataev   operator int() { return 6; }
10214a388f4SAlexey Bataev } o;
10314a388f4SAlexey Bataev 
10414a388f4SAlexey Bataev struct S7 {
10514a388f4SAlexey Bataev   int a: 32;
S7S710614a388f4SAlexey Bataev   S7() {
10714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+:a) // expected-error {{expected addressable reduction item for the task-based directives}}
10814a388f4SAlexey Bataev     for (int i = 0; i < 10; ++i)
10914a388f4SAlexey Bataev       ++a;
11014a388f4SAlexey Bataev   }
11114a388f4SAlexey Bataev };
11214a388f4SAlexey Bataev 
11314a388f4SAlexey Bataev S3 h, k;
11414a388f4SAlexey Bataev #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
11514a388f4SAlexey Bataev 
11614a388f4SAlexey Bataev template <class T>       // expected-note {{declared here}}
tmain(T argc)11714a388f4SAlexey Bataev T tmain(T argc) {
11814a388f4SAlexey Bataev   const T d = T();       // expected-note 4 {{'d' defined here}}
11914a388f4SAlexey Bataev   const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
12014a388f4SAlexey Bataev   T qa[5] = {T()};
12114a388f4SAlexey Bataev   T i, z;
12214a388f4SAlexey Bataev   T &j = i;                        // expected-note 4 {{'j' defined here}}
12314a388f4SAlexey Bataev   S3 &p = k;                       // expected-note 2 {{'p' defined here}}
12414a388f4SAlexey Bataev   const T &r = da[(int)i];         // expected-note 2 {{'r' defined here}}
12514a388f4SAlexey Bataev   T &q = qa[(int)i];               // expected-note 2 {{'q' defined here}}
12614a388f4SAlexey Bataev   T fl;
12714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction // expected-error {{expected '(' after 'reduction'}}
12814a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
12914a388f4SAlexey Bataev     foo();
13014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
13114a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
13214a388f4SAlexey Bataev     foo();
13314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
13414a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
13514a388f4SAlexey Bataev     foo();
13614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
13714a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
13814a388f4SAlexey Bataev     foo();
13914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
14014a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
14114a388f4SAlexey Bataev     foo();
14214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
14314a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
14414a388f4SAlexey Bataev     foo();
14514a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
14614a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
14714a388f4SAlexey Bataev     foo();
14814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
14914a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
15014a388f4SAlexey Bataev     foo();
15114a388f4SAlexey Bataev #pragma omp parallel 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')}}
15214a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
15314a388f4SAlexey Bataev     foo();
15414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
15514a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
15614a388f4SAlexey Bataev     foo();
15714a388f4SAlexey Bataev #pragma omp parallel 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'}}
15814a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
15914a388f4SAlexey Bataev     foo();
16014a388f4SAlexey Bataev #pragma omp parallel 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 '('}}
16114a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
16214a388f4SAlexey Bataev     foo();
16314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(^ : T) // expected-error {{'T' does not refer to a value}}
16414a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
16514a388f4SAlexey Bataev     foo();
16614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : z, 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'}}
16714a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
16814a388f4SAlexey Bataev     foo();
16914a388f4SAlexey Bataev #pragma omp parallel 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}}
17014a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
17114a388f4SAlexey Bataev     foo();
17214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
17314a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
17414a388f4SAlexey Bataev     foo();
17514a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
17614a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
17714a388f4SAlexey Bataev     foo();
17814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
17914a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
18014a388f4SAlexey Bataev     foo();
18114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
18214a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
18314a388f4SAlexey Bataev     foo();
18414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
18514a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
18614a388f4SAlexey Bataev     foo();
18714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
18814a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
18914a388f4SAlexey Bataev     foo();
19014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
19114a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
19214a388f4SAlexey Bataev     foo();
19314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
19414a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
19514a388f4SAlexey Bataev     foo();
19614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
19714a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
19814a388f4SAlexey Bataev     foo();
19914a388f4SAlexey Bataev #pragma omp parallel 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}}
20014a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
20114a388f4SAlexey Bataev     foo();
20214a388f4SAlexey Bataev #pragma omp parallel private(k)
20314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
20414a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
20514a388f4SAlexey Bataev     foo();
20614a388f4SAlexey Bataev #pragma omp parallel 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}}
20714a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
20814a388f4SAlexey Bataev     foo();
20914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
21014a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
21114a388f4SAlexey Bataev     foo();
21214a388f4SAlexey Bataev #pragma omp parallel shared(i)
21314a388f4SAlexey Bataev #pragma omp parallel reduction(min : i)
21414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
21514a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
21614a388f4SAlexey Bataev     foo();
21714a388f4SAlexey Bataev #pragma omp parallel private(fl)
21814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'parallel master taskloop simd' directive}}
21914a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
22014a388f4SAlexey Bataev     foo();
22114a388f4SAlexey Bataev #pragma omp parallel reduction(* : fl)
22214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : fl)
22314a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
22414a388f4SAlexey Bataev     foo();
22514a388f4SAlexey Bataev 
22614a388f4SAlexey Bataev   return T();
22714a388f4SAlexey Bataev }
22814a388f4SAlexey Bataev 
22914a388f4SAlexey Bataev namespace A {
23014a388f4SAlexey Bataev double x;
23114a388f4SAlexey Bataev #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
23214a388f4SAlexey Bataev }
23314a388f4SAlexey Bataev namespace B {
23414a388f4SAlexey Bataev using A::x;
23514a388f4SAlexey Bataev }
23614a388f4SAlexey Bataev 
main(int argc,char ** argv)23714a388f4SAlexey Bataev int main(int argc, char **argv) {
23814a388f4SAlexey Bataev   const int d = 5;       // expected-note 2 {{'d' defined here}}
23914a388f4SAlexey Bataev   const int da[5] = {0}; // expected-note {{'da' defined here}}
24014a388f4SAlexey Bataev   int qa[5] = {0};
24114a388f4SAlexey Bataev   S4 e(4);
24214a388f4SAlexey Bataev   S5 g(5);
24314a388f4SAlexey Bataev   int i, z;
24414a388f4SAlexey Bataev   int &j = i;                      // expected-note 2 {{'j' defined here}}
24514a388f4SAlexey Bataev   S3 &p = k;                       // expected-note 2 {{'p' defined here}}
24614a388f4SAlexey Bataev   const int &r = da[i];            // expected-note {{'r' defined here}}
24714a388f4SAlexey Bataev   int &q = qa[i];                  // expected-note {{'q' defined here}}
24814a388f4SAlexey Bataev   float fl;
24914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction // expected-error {{expected '(' after 'reduction'}}
25014a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
25114a388f4SAlexey Bataev     foo();
25214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
25314a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
25414a388f4SAlexey Bataev     foo();
25514a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
25614a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
25714a388f4SAlexey Bataev     foo();
25814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
25914a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
26014a388f4SAlexey Bataev     foo();
26114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
26214a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
26314a388f4SAlexey Bataev     foo();
26414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
26514a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
26614a388f4SAlexey Bataev     foo();
26714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
26814a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
26914a388f4SAlexey Bataev     foo();
27014a388f4SAlexey Bataev #pragma omp parallel 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'}}
27114a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
27214a388f4SAlexey Bataev     foo();
27314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27414a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
27514a388f4SAlexey Bataev     foo();
27614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
27714a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
27814a388f4SAlexey Bataev     foo();
27914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(~ : argc) // expected-error {{expected unqualified-id}}
28014a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
28114a388f4SAlexey Bataev     foo();
28214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(&& : argc, z)
28314a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
28414a388f4SAlexey Bataev     foo();
28514a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
28614a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
28714a388f4SAlexey Bataev     foo();
28814a388f4SAlexey Bataev #pragma omp parallel 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'}}
28914a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
29014a388f4SAlexey Bataev     foo();
29114a388f4SAlexey Bataev #pragma omp parallel 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}}
29214a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
29314a388f4SAlexey Bataev     foo();
29414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
29514a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
29614a388f4SAlexey Bataev     foo();
29714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
29814a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
29914a388f4SAlexey Bataev     foo();
30014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
30114a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
30214a388f4SAlexey Bataev     foo();
30314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
30414a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
30514a388f4SAlexey Bataev     foo();
30614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
30714a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
30814a388f4SAlexey Bataev     foo();
30914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
31014a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
31114a388f4SAlexey Bataev     foo();
31214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
31314a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
31414a388f4SAlexey Bataev     foo();
315*f90abac6SMike Rice #pragma omp parallel master taskloop simd 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')}}
31614a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
31714a388f4SAlexey Bataev     foo();
31814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
31914a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
32014a388f4SAlexey Bataev     foo();
32114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : o) // expected-error {{no viable overloaded '='}}
32214a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
32314a388f4SAlexey Bataev     foo();
32414a388f4SAlexey Bataev #pragma omp parallel 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}}
32514a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
32614a388f4SAlexey Bataev     foo();
32714a388f4SAlexey Bataev #pragma omp parallel private(k)
32814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
32914a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
33014a388f4SAlexey Bataev     foo();
33114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
33214a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
33314a388f4SAlexey Bataev     foo();
33414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
33514a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
33614a388f4SAlexey Bataev     foo();
33714a388f4SAlexey Bataev #pragma omp parallel shared(i)
33814a388f4SAlexey Bataev #pragma omp parallel reduction(min : i)
33914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
34014a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
34114a388f4SAlexey Bataev     foo();
34214a388f4SAlexey Bataev #pragma omp parallel private(fl)
34314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : fl)
34414a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
34514a388f4SAlexey Bataev     foo();
34614a388f4SAlexey Bataev #pragma omp parallel reduction(* : fl)
34714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : fl)
34814a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
34914a388f4SAlexey Bataev     foo();
35014a388f4SAlexey Bataev   static int m;
35114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd reduction(+ : m) // OK
35214a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
35314a388f4SAlexey Bataev     m++;
3541c1d9d9dSAlexey Bataev #pragma omp parallel 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}}
3551c1d9d9dSAlexey Bataev   for (int i = 0; i < 10; ++i)
3561c1d9d9dSAlexey Bataev     m++;
35714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd nogroup reduction(+ : m) // expected-error {{'reduction' clause cannot be used with 'nogroup' clause}}
35814a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
35914a388f4SAlexey Bataev     m++;
36014a388f4SAlexey Bataev 
36114a388f4SAlexey 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}}
36214a388f4SAlexey Bataev }
363