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