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
4ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -ferror-limit 150 -o - %s -Wuninitialized
5ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
6ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
75bbceadfSAlexey 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
11ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -ferror-limit 150 -o - %s -Wuninitialized
12ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
13ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
145bbceadfSAlexey Bataev 
155bbceadfSAlexey Bataev typedef void **omp_allocator_handle_t;
168026394dSAlexey Bataev extern const omp_allocator_handle_t omp_null_allocator;
175bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_default_mem_alloc;
185bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
195bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_const_mem_alloc;
205bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
215bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
225bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
235bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_pteam_mem_alloc;
245bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_thread_mem_alloc;
255bbceadfSAlexey Bataev 
xxx(int argc)265bbceadfSAlexey Bataev void xxx(int argc) {
275bbceadfSAlexey Bataev   int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
285bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
295bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
305bbceadfSAlexey Bataev     ;
315bbceadfSAlexey Bataev }
325bbceadfSAlexey Bataev 
foo()335bbceadfSAlexey Bataev void foo() {
345bbceadfSAlexey Bataev }
355bbceadfSAlexey Bataev 
foobool(int argc)365bbceadfSAlexey Bataev bool foobool(int argc) {
375bbceadfSAlexey Bataev   return argc;
385bbceadfSAlexey Bataev }
395bbceadfSAlexey Bataev 
foobar(int & ref)405bbceadfSAlexey Bataev void foobar(int &ref) {
415bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+:ref)
425bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
435bbceadfSAlexey Bataev     foo();
445bbceadfSAlexey Bataev }
455bbceadfSAlexey Bataev 
465bbceadfSAlexey Bataev struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
475bbceadfSAlexey Bataev extern S1 a;
485bbceadfSAlexey Bataev class S2 {
495bbceadfSAlexey Bataev   mutable int a;
operator +(const S2 & arg)505bbceadfSAlexey Bataev   S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}}
515bbceadfSAlexey Bataev 
525bbceadfSAlexey Bataev public:
S2()535bbceadfSAlexey Bataev   S2() : a(0) {}
S2(S2 & s2)545bbceadfSAlexey Bataev   S2(S2 &s2) : a(s2.a) {}
555bbceadfSAlexey Bataev   static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
565bbceadfSAlexey Bataev   static const float S2sc; // expected-note 2 {{'S2sc' declared here}}
575bbceadfSAlexey Bataev };
585bbceadfSAlexey Bataev const float S2::S2sc = 0;
595bbceadfSAlexey Bataev S2 b;                     // expected-note 3 {{'b' defined here}}
605bbceadfSAlexey Bataev const S2 ba[5];           // expected-note 2 {{'ba' defined here}}
615bbceadfSAlexey Bataev class S3 {
625bbceadfSAlexey Bataev   int a;
635bbceadfSAlexey Bataev 
645bbceadfSAlexey Bataev public:
655bbceadfSAlexey Bataev   int b;
S3()665bbceadfSAlexey Bataev   S3() : a(0) {}
S3(const S3 & s3)675bbceadfSAlexey Bataev   S3(const S3 &s3) : a(s3.a) {}
operator +(const S3 & arg1)685bbceadfSAlexey Bataev   S3 operator+(const S3 &arg1) { return arg1; }
695bbceadfSAlexey Bataev };
operator +(const S3 & arg1,const S3 & arg2)705bbceadfSAlexey Bataev int operator+(const S3 &arg1, const S3 &arg2) { return 5; }
715bbceadfSAlexey Bataev S3 c;               // expected-note 3 {{'c' defined here}}
725bbceadfSAlexey Bataev const S3 ca[5];     // expected-note 2 {{'ca' defined here}}
735bbceadfSAlexey Bataev extern const int f; // expected-note 4 {{'f' declared here}}
745bbceadfSAlexey Bataev class S4 {
755bbceadfSAlexey Bataev   int a;
765bbceadfSAlexey Bataev   S4(); // expected-note {{implicitly declared private here}}
775bbceadfSAlexey Bataev   S4(const S4 &s4);
operator +(const S4 & arg)785bbceadfSAlexey Bataev   S4 &operator+(const S4 &arg) { return (*this); }
795bbceadfSAlexey Bataev 
805bbceadfSAlexey Bataev public:
S4(int v)815bbceadfSAlexey Bataev   S4(int v) : a(v) {}
825bbceadfSAlexey Bataev };
operator &=(S4 & arg1,S4 & arg2)835bbceadfSAlexey Bataev S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
845bbceadfSAlexey Bataev class S5 {
855bbceadfSAlexey Bataev   int a:32;
S5()865bbceadfSAlexey Bataev   S5() : a(0) {} // expected-note {{implicitly declared private here}}
S5(const S5 & s5)875bbceadfSAlexey Bataev   S5(const S5 &s5) : a(s5.a) {}
885bbceadfSAlexey Bataev   S5 &operator+(const S5 &arg);
895bbceadfSAlexey Bataev 
905bbceadfSAlexey Bataev public:
S5(int v)915bbceadfSAlexey Bataev   S5(int v) : a(v) {}
925bbceadfSAlexey Bataev };
935bbceadfSAlexey 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}}
945bbceadfSAlexey Bataev #if __cplusplus >= 201103L // C++11 or later
955bbceadfSAlexey Bataev // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}}
965bbceadfSAlexey Bataev #endif
975bbceadfSAlexey Bataev   int a;
985bbceadfSAlexey Bataev 
995bbceadfSAlexey Bataev public:
S6()1005bbceadfSAlexey Bataev   S6() : a(6) {}
operator int()1015bbceadfSAlexey Bataev   operator int() { return 6; }
1025bbceadfSAlexey Bataev } o;
1035bbceadfSAlexey Bataev 
1045bbceadfSAlexey Bataev struct S7 {
1055bbceadfSAlexey Bataev   int a: 32;
S7S71065bbceadfSAlexey Bataev   S7() {
1075bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+:a) // expected-error {{expected addressable reduction item for the task-based directives}}
1085bbceadfSAlexey Bataev     for (int i = 0; i < 10; ++i)
1095bbceadfSAlexey Bataev       ++a;
1105bbceadfSAlexey Bataev   }
1115bbceadfSAlexey Bataev };
1125bbceadfSAlexey Bataev 
1135bbceadfSAlexey Bataev S3 h, k;
1145bbceadfSAlexey Bataev #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
1155bbceadfSAlexey Bataev 
1165bbceadfSAlexey Bataev template <class T>       // expected-note {{declared here}}
tmain(T argc)1175bbceadfSAlexey Bataev T tmain(T argc) {
1185bbceadfSAlexey Bataev   const T d = T();       // expected-note 4 {{'d' defined here}}
1195bbceadfSAlexey Bataev   const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
1205bbceadfSAlexey Bataev   T qa[5] = {T()};
1215bbceadfSAlexey Bataev   T i, z;
1225bbceadfSAlexey Bataev   T &j = i;                        // expected-note 4 {{'j' defined here}}
1235bbceadfSAlexey Bataev   S3 &p = k;                       // expected-note 2 {{'p' defined here}}
1245bbceadfSAlexey Bataev   const T &r = da[(int)i];         // expected-note 2 {{'r' defined here}}
1255bbceadfSAlexey Bataev   T &q = qa[(int)i];               // expected-note 2 {{'q' defined here}}
1265bbceadfSAlexey Bataev   T fl;
1275bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction // expected-error {{expected '(' after 'reduction'}}
1285bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1295bbceadfSAlexey Bataev     foo();
1305bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop' are ignored}}
1315bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1325bbceadfSAlexey Bataev     foo();
1335bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
1345bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1355bbceadfSAlexey Bataev     foo();
1365bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
1375bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1385bbceadfSAlexey Bataev     foo();
1395bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
1405bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1415bbceadfSAlexey Bataev     foo();
1425bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
1435bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1445bbceadfSAlexey Bataev     foo();
1455bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
1465bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1475bbceadfSAlexey Bataev     foo();
1485bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
1495bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1505bbceadfSAlexey Bataev     foo();
1515bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
1525bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1535bbceadfSAlexey Bataev     foo();
1545bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
1555bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1565bbceadfSAlexey Bataev     foo();
1575bbceadfSAlexey Bataev #pragma omp parallel master taskloop 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'}}
1585bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1595bbceadfSAlexey Bataev     foo();
1605bbceadfSAlexey Bataev #pragma omp parallel master taskloop 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 '('}}
1615bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1625bbceadfSAlexey Bataev     foo();
1635bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(^ : T) // expected-error {{'T' does not refer to a value}}
1645bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1655bbceadfSAlexey Bataev     foo();
1665bbceadfSAlexey Bataev #pragma omp parallel master taskloop 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'}}
1675bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1685bbceadfSAlexey Bataev     foo();
1695bbceadfSAlexey Bataev #pragma omp parallel master taskloop 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}}
1705bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1715bbceadfSAlexey Bataev     foo();
1725bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
1735bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1745bbceadfSAlexey Bataev     foo();
1755bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
1765bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1775bbceadfSAlexey Bataev     foo();
1785bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
1795bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1805bbceadfSAlexey Bataev     foo();
1815bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
1825bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1835bbceadfSAlexey Bataev     foo();
1845bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
1855bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1865bbceadfSAlexey Bataev     foo();
1875bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
1885bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1895bbceadfSAlexey Bataev     foo();
1905bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
1915bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1925bbceadfSAlexey Bataev     foo();
1935bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
1945bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1955bbceadfSAlexey Bataev     foo();
1965bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
1975bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
1985bbceadfSAlexey Bataev     foo();
1995bbceadfSAlexey Bataev #pragma omp parallel master taskloop private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
2005bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2015bbceadfSAlexey Bataev     foo();
2025bbceadfSAlexey Bataev #pragma omp parallel private(k)
2035bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
2045bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2055bbceadfSAlexey Bataev     foo();
2065bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}}
2075bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2085bbceadfSAlexey Bataev     foo();
2095bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
2105bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2115bbceadfSAlexey Bataev     foo();
2125bbceadfSAlexey Bataev #pragma omp parallel shared(i)
2135bbceadfSAlexey Bataev #pragma omp parallel reduction(min : i)
2145bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
2155bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2165bbceadfSAlexey Bataev     foo();
2175bbceadfSAlexey Bataev #pragma omp parallel private(fl)
2185bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'parallel master taskloop' directive}}
2195bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2205bbceadfSAlexey Bataev     foo();
2215bbceadfSAlexey Bataev #pragma omp parallel reduction(* : fl)
2225bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : fl)
2235bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2245bbceadfSAlexey Bataev     foo();
2255bbceadfSAlexey Bataev 
2265bbceadfSAlexey Bataev   return T();
2275bbceadfSAlexey Bataev }
2285bbceadfSAlexey Bataev 
2295bbceadfSAlexey Bataev namespace A {
2305bbceadfSAlexey Bataev double x;
2315bbceadfSAlexey Bataev #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
2325bbceadfSAlexey Bataev }
2335bbceadfSAlexey Bataev namespace B {
2345bbceadfSAlexey Bataev using A::x;
2355bbceadfSAlexey Bataev }
2365bbceadfSAlexey Bataev 
main(int argc,char ** argv)2375bbceadfSAlexey Bataev int main(int argc, char **argv) {
2385bbceadfSAlexey Bataev   const int d = 5;       // expected-note 2 {{'d' defined here}}
2395bbceadfSAlexey Bataev   const int da[5] = {0}; // expected-note {{'da' defined here}}
2405bbceadfSAlexey Bataev   int qa[5] = {0};
2415bbceadfSAlexey Bataev   S4 e(4);
2425bbceadfSAlexey Bataev   S5 g(5);
2435bbceadfSAlexey Bataev   int i, z;
2445bbceadfSAlexey Bataev   int &j = i;                      // expected-note 2 {{'j' defined here}}
2455bbceadfSAlexey Bataev   S3 &p = k;                       // expected-note 2 {{'p' defined here}}
2465bbceadfSAlexey Bataev   const int &r = da[i];            // expected-note {{'r' defined here}}
2475bbceadfSAlexey Bataev   int &q = qa[i];                  // expected-note {{'q' defined here}}
2485bbceadfSAlexey Bataev   float fl;
2495bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction // expected-error {{expected '(' after 'reduction'}}
2505bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2515bbceadfSAlexey Bataev     foo();
2525bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop' are ignored}}
2535bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2545bbceadfSAlexey Bataev     foo();
2555bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
2565bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2575bbceadfSAlexey Bataev     foo();
2585bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
2595bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2605bbceadfSAlexey Bataev     foo();
2615bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
2625bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2635bbceadfSAlexey Bataev     foo();
2645bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
2655bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2665bbceadfSAlexey Bataev     foo();
2675bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
2685bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2695bbceadfSAlexey Bataev     foo();
2705bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
2715bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2725bbceadfSAlexey Bataev     foo();
2735bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
2745bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2755bbceadfSAlexey Bataev     foo();
2765bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
2775bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2785bbceadfSAlexey Bataev     foo();
2795bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(~ : argc) // expected-error {{expected unqualified-id}}
2805bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2815bbceadfSAlexey Bataev     foo();
2825bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(&& : argc, z)
2835bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2845bbceadfSAlexey Bataev     foo();
2855bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
2865bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2875bbceadfSAlexey Bataev     foo();
2885bbceadfSAlexey Bataev #pragma omp parallel master taskloop 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'}}
2895bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2905bbceadfSAlexey Bataev     foo();
2915bbceadfSAlexey Bataev #pragma omp parallel master taskloop 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}}
2925bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2935bbceadfSAlexey Bataev     foo();
2945bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
2955bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2965bbceadfSAlexey Bataev     foo();
2975bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
2985bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
2995bbceadfSAlexey Bataev     foo();
3005bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
3015bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3025bbceadfSAlexey Bataev     foo();
3035bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
3045bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3055bbceadfSAlexey Bataev     foo();
3065bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
3075bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3085bbceadfSAlexey Bataev     foo();
3095bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
3105bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3115bbceadfSAlexey Bataev     foo();
3125bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
3135bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3145bbceadfSAlexey Bataev     foo();
315*f90abac6SMike Rice #pragma omp parallel master taskloop 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')}}
3165bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3175bbceadfSAlexey Bataev     foo();
3185bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
3195bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3205bbceadfSAlexey Bataev     foo();
3215bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : o) // expected-error {{no viable overloaded '='}}
3225bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3235bbceadfSAlexey Bataev     foo();
3245bbceadfSAlexey Bataev #pragma omp parallel master taskloop private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
3255bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3265bbceadfSAlexey Bataev     foo();
3275bbceadfSAlexey Bataev #pragma omp parallel private(k)
3285bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
3295bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3305bbceadfSAlexey Bataev     foo();
3315bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
3325bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3335bbceadfSAlexey Bataev     foo();
3345bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
3355bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3365bbceadfSAlexey Bataev     foo();
3375bbceadfSAlexey Bataev #pragma omp parallel shared(i)
3385bbceadfSAlexey Bataev #pragma omp parallel reduction(min : i)
3395bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
3405bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3415bbceadfSAlexey Bataev     foo();
3425bbceadfSAlexey Bataev #pragma omp parallel private(fl)
3435bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : fl)
3445bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3455bbceadfSAlexey Bataev     foo();
3465bbceadfSAlexey Bataev #pragma omp parallel reduction(* : fl)
3475bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : fl)
3485bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3495bbceadfSAlexey Bataev     foo();
3505bbceadfSAlexey Bataev   static int m;
3515bbceadfSAlexey Bataev #pragma omp parallel master taskloop reduction(+ : m) // OK
3525bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3535bbceadfSAlexey Bataev     m++;
3541c1d9d9dSAlexey Bataev #pragma omp parallel master taskloop reduction(task, + : m) // omp45-error 2 {{expected expression}} omp45-warning {{missing ':' after reduction identifier - ignoring}}
3551c1d9d9dSAlexey Bataev   for (int i = 0; i < 10; ++i)
3561c1d9d9dSAlexey Bataev     m++;
3575bbceadfSAlexey Bataev #pragma omp parallel master taskloop nogroup reduction(+ : m) // expected-error {{'reduction' clause cannot be used with 'nogroup' clause}}
3585bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
3595bbceadfSAlexey Bataev     m++;
3605bbceadfSAlexey Bataev 
3615bbceadfSAlexey 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}}
3625bbceadfSAlexey Bataev }
363