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 760e51c48SAlexey 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 1460e51c48SAlexey Bataev 1560e51c48SAlexey Bataev typedef void **omp_allocator_handle_t; 1660e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_default_mem_alloc; 1760e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_large_cap_mem_alloc; 1860e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_const_mem_alloc; 1960e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_high_bw_mem_alloc; 2060e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_low_lat_mem_alloc; 2160e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_cgroup_mem_alloc; 2260e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_pteam_mem_alloc; 2360e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_thread_mem_alloc; 2460e51c48SAlexey Bataev 2560e51c48SAlexey Bataev void xxx(int argc) { 2660e51c48SAlexey Bataev int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} 2760e51c48SAlexey Bataev #pragma omp master taskloop reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} 2860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 2960e51c48SAlexey Bataev ; 3060e51c48SAlexey Bataev } 3160e51c48SAlexey Bataev 3260e51c48SAlexey Bataev void foo() { 3360e51c48SAlexey Bataev } 3460e51c48SAlexey Bataev 3560e51c48SAlexey Bataev bool foobool(int argc) { 3660e51c48SAlexey Bataev return argc; 3760e51c48SAlexey Bataev } 3860e51c48SAlexey Bataev 3960e51c48SAlexey Bataev void foobar(int &ref) { 4060e51c48SAlexey Bataev #pragma omp master taskloop reduction(+:ref) 4160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 4260e51c48SAlexey Bataev foo(); 4360e51c48SAlexey Bataev } 4460e51c48SAlexey Bataev 4560e51c48SAlexey Bataev struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}} 4660e51c48SAlexey Bataev extern S1 a; 4760e51c48SAlexey Bataev class S2 { 4860e51c48SAlexey Bataev mutable int a; 4960e51c48SAlexey Bataev S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}} 5060e51c48SAlexey Bataev 5160e51c48SAlexey Bataev public: 5260e51c48SAlexey Bataev S2() : a(0) {} 5360e51c48SAlexey Bataev S2(S2 &s2) : a(s2.a) {} 5460e51c48SAlexey Bataev static float S2s; // expected-note 2 {{static data member is predetermined as shared}} 5560e51c48SAlexey Bataev static const float S2sc; // expected-note 2 {{'S2sc' declared here}} 5660e51c48SAlexey Bataev }; 5760e51c48SAlexey Bataev const float S2::S2sc = 0; 5860e51c48SAlexey Bataev S2 b; // expected-note 3 {{'b' defined here}} 5960e51c48SAlexey Bataev const S2 ba[5]; // expected-note 2 {{'ba' defined here}} 6060e51c48SAlexey Bataev class S3 { 6160e51c48SAlexey Bataev int a; 6260e51c48SAlexey Bataev 6360e51c48SAlexey Bataev public: 6460e51c48SAlexey Bataev int b; 6560e51c48SAlexey Bataev S3() : a(0) {} 6660e51c48SAlexey Bataev S3(const S3 &s3) : a(s3.a) {} 6760e51c48SAlexey Bataev S3 operator+(const S3 &arg1) { return arg1; } 6860e51c48SAlexey Bataev }; 6960e51c48SAlexey Bataev int operator+(const S3 &arg1, const S3 &arg2) { return 5; } 7060e51c48SAlexey Bataev S3 c; // expected-note 3 {{'c' defined here}} 7160e51c48SAlexey Bataev const S3 ca[5]; // expected-note 2 {{'ca' defined here}} 7260e51c48SAlexey Bataev extern const int f; // expected-note 4 {{'f' declared here}} 7360e51c48SAlexey Bataev class S4 { 7460e51c48SAlexey Bataev int a; 7560e51c48SAlexey Bataev S4(); // expected-note {{implicitly declared private here}} 7660e51c48SAlexey Bataev S4(const S4 &s4); 7760e51c48SAlexey Bataev S4 &operator+(const S4 &arg) { return (*this); } 7860e51c48SAlexey Bataev 7960e51c48SAlexey Bataev public: 8060e51c48SAlexey Bataev S4(int v) : a(v) {} 8160e51c48SAlexey Bataev }; 8260e51c48SAlexey Bataev S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; } 8360e51c48SAlexey Bataev class S5 { 8460e51c48SAlexey Bataev int a:32; 8560e51c48SAlexey Bataev S5() : a(0) {} // expected-note {{implicitly declared private here}} 8660e51c48SAlexey Bataev S5(const S5 &s5) : a(s5.a) {} 8760e51c48SAlexey Bataev S5 &operator+(const S5 &arg); 8860e51c48SAlexey Bataev 8960e51c48SAlexey Bataev public: 9060e51c48SAlexey Bataev S5(int v) : a(v) {} 9160e51c48SAlexey Bataev }; 9260e51c48SAlexey 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}} 9360e51c48SAlexey Bataev #if __cplusplus >= 201103L // C++11 or later 9460e51c48SAlexey Bataev // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}} 9560e51c48SAlexey Bataev #endif 9660e51c48SAlexey Bataev int a; 9760e51c48SAlexey Bataev 9860e51c48SAlexey Bataev public: 9960e51c48SAlexey Bataev S6() : a(6) {} 10060e51c48SAlexey Bataev operator int() { return 6; } 10160e51c48SAlexey Bataev } o; 10260e51c48SAlexey Bataev 10360e51c48SAlexey Bataev struct S7 { 10460e51c48SAlexey Bataev int a: 32; 10560e51c48SAlexey Bataev S7() { 10660e51c48SAlexey Bataev #pragma omp master taskloop reduction(+:a) // expected-error {{expected addressable reduction item for the task-based directives}} 10760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 10860e51c48SAlexey Bataev ++a; 10960e51c48SAlexey Bataev } 11060e51c48SAlexey Bataev }; 11160e51c48SAlexey Bataev 11260e51c48SAlexey Bataev S3 h, k; 11360e51c48SAlexey Bataev #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} 11460e51c48SAlexey Bataev 11560e51c48SAlexey Bataev template <class T> // expected-note {{declared here}} 11660e51c48SAlexey Bataev T tmain(T argc) { 11760e51c48SAlexey Bataev const T d = T(); // expected-note 4 {{'d' defined here}} 11860e51c48SAlexey Bataev const T da[5] = {T()}; // expected-note 2 {{'da' defined here}} 11960e51c48SAlexey Bataev T qa[5] = {T()}; 12060e51c48SAlexey Bataev T i, z; 12160e51c48SAlexey Bataev T &j = i; // expected-note 4 {{'j' defined here}} 12260e51c48SAlexey Bataev S3 &p = k; // expected-note 2 {{'p' defined here}} 12360e51c48SAlexey Bataev const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}} 12460e51c48SAlexey Bataev T &q = qa[(int)i]; // expected-note 2 {{'q' defined here}} 12560e51c48SAlexey Bataev T fl; 12660e51c48SAlexey Bataev #pragma omp master taskloop reduction // expected-error {{expected '(' after 'reduction'}} 12760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 12860e51c48SAlexey Bataev foo(); 12960e51c48SAlexey Bataev #pragma omp master taskloop reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp master taskloop' are ignored}} 13060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 13160e51c48SAlexey Bataev foo(); 13260e51c48SAlexey Bataev #pragma omp master taskloop reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} 13360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 13460e51c48SAlexey Bataev foo(); 13560e51c48SAlexey Bataev #pragma omp master taskloop reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 13660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 13760e51c48SAlexey Bataev foo(); 13860e51c48SAlexey Bataev #pragma omp master taskloop reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} 13960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 14060e51c48SAlexey Bataev foo(); 14160e51c48SAlexey Bataev #pragma omp master taskloop reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} 14260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 14360e51c48SAlexey Bataev foo(); 14460e51c48SAlexey Bataev #pragma omp master taskloop reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} 14560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 14660e51c48SAlexey Bataev foo(); 14760e51c48SAlexey Bataev #pragma omp master taskloop reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}} 14860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 14960e51c48SAlexey Bataev foo(); 15060e51c48SAlexey Bataev #pragma omp 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')}} 15160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 15260e51c48SAlexey Bataev foo(); 15360e51c48SAlexey Bataev #pragma omp master taskloop reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}} 15460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 15560e51c48SAlexey Bataev foo(); 15660e51c48SAlexey Bataev #pragma omp 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'}} 15760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 15860e51c48SAlexey Bataev foo(); 15960e51c48SAlexey Bataev #pragma omp 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 '('}} 16060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 16160e51c48SAlexey Bataev foo(); 16260e51c48SAlexey Bataev #pragma omp master taskloop reduction(^ : T) // expected-error {{'T' does not refer to a value}} 16360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 16460e51c48SAlexey Bataev foo(); 16560e51c48SAlexey Bataev #pragma omp 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'}} 16660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 16760e51c48SAlexey Bataev foo(); 16860e51c48SAlexey Bataev #pragma omp 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}} 16960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 17060e51c48SAlexey Bataev foo(); 17160e51c48SAlexey Bataev #pragma omp master taskloop reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} 17260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 17360e51c48SAlexey Bataev foo(); 17460e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}} 17560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 17660e51c48SAlexey Bataev foo(); 17760e51c48SAlexey Bataev #pragma omp master taskloop reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}} 17860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 17960e51c48SAlexey Bataev foo(); 18060e51c48SAlexey Bataev #pragma omp master taskloop reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}} 18160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 18260e51c48SAlexey Bataev foo(); 18360e51c48SAlexey Bataev #pragma omp master taskloop reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}} 18460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 18560e51c48SAlexey Bataev foo(); 18660e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} 18760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 18860e51c48SAlexey Bataev foo(); 18960e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}} 19060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 19160e51c48SAlexey Bataev foo(); 19260e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} 19360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 19460e51c48SAlexey Bataev foo(); 19560e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : o) // expected-error 2 {{no viable overloaded '='}} 19660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 19760e51c48SAlexey Bataev foo(); 19860e51c48SAlexey Bataev #pragma omp master taskloop private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} 19960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 20060e51c48SAlexey Bataev foo(); 20160e51c48SAlexey Bataev #pragma omp parallel private(k) 20260e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} 20360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 20460e51c48SAlexey Bataev foo(); 20560e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}} 20660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 20760e51c48SAlexey Bataev foo(); 20860e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}} 20960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 21060e51c48SAlexey Bataev foo(); 21160e51c48SAlexey Bataev #pragma omp parallel shared(i) 21260e51c48SAlexey Bataev #pragma omp parallel reduction(min : i) 21360e51c48SAlexey Bataev #pragma omp master taskloop reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} 21460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 21560e51c48SAlexey Bataev foo(); 21660e51c48SAlexey Bataev #pragma omp parallel private(fl) 21760e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'master taskloop' directive}} 21860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 21960e51c48SAlexey Bataev foo(); 22060e51c48SAlexey Bataev #pragma omp parallel reduction(* : fl) 22160e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : fl) 22260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 22360e51c48SAlexey Bataev foo(); 22460e51c48SAlexey Bataev 22560e51c48SAlexey Bataev return T(); 22660e51c48SAlexey Bataev } 22760e51c48SAlexey Bataev 22860e51c48SAlexey Bataev namespace A { 22960e51c48SAlexey Bataev double x; 23060e51c48SAlexey Bataev #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} 23160e51c48SAlexey Bataev } 23260e51c48SAlexey Bataev namespace B { 23360e51c48SAlexey Bataev using A::x; 23460e51c48SAlexey Bataev } 23560e51c48SAlexey Bataev 23660e51c48SAlexey Bataev int main(int argc, char **argv) { 23760e51c48SAlexey Bataev const int d = 5; // expected-note 2 {{'d' defined here}} 23860e51c48SAlexey Bataev const int da[5] = {0}; // expected-note {{'da' defined here}} 23960e51c48SAlexey Bataev int qa[5] = {0}; 24060e51c48SAlexey Bataev S4 e(4); 24160e51c48SAlexey Bataev S5 g(5); 24260e51c48SAlexey Bataev int i, z; 24360e51c48SAlexey Bataev int &j = i; // expected-note 2 {{'j' defined here}} 24460e51c48SAlexey Bataev S3 &p = k; // expected-note 2 {{'p' defined here}} 24560e51c48SAlexey Bataev const int &r = da[i]; // expected-note {{'r' defined here}} 24660e51c48SAlexey Bataev int &q = qa[i]; // expected-note {{'q' defined here}} 24760e51c48SAlexey Bataev float fl; 24860e51c48SAlexey Bataev #pragma omp master taskloop reduction // expected-error {{expected '(' after 'reduction'}} 24960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 25060e51c48SAlexey Bataev foo(); 25160e51c48SAlexey Bataev #pragma omp master taskloop reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp master taskloop' are ignored}} 25260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 25360e51c48SAlexey Bataev foo(); 25460e51c48SAlexey Bataev #pragma omp master taskloop reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} 25560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 25660e51c48SAlexey Bataev foo(); 25760e51c48SAlexey Bataev #pragma omp master taskloop reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 25860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 25960e51c48SAlexey Bataev foo(); 26060e51c48SAlexey Bataev #pragma omp master taskloop reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} 26160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 26260e51c48SAlexey Bataev foo(); 26360e51c48SAlexey Bataev #pragma omp master taskloop reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} 26460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 26560e51c48SAlexey Bataev foo(); 26660e51c48SAlexey Bataev #pragma omp master taskloop reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} 26760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 26860e51c48SAlexey Bataev foo(); 26960e51c48SAlexey Bataev #pragma omp master taskloop reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}} 27060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 27160e51c48SAlexey Bataev foo(); 27260e51c48SAlexey Bataev #pragma omp master taskloop reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 27360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 27460e51c48SAlexey Bataev foo(); 27560e51c48SAlexey Bataev #pragma omp master taskloop reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}} 27660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 27760e51c48SAlexey Bataev foo(); 27860e51c48SAlexey Bataev #pragma omp master taskloop reduction(~ : argc) // expected-error {{expected unqualified-id}} 27960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 28060e51c48SAlexey Bataev foo(); 28160e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : argc, z) 28260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 28360e51c48SAlexey Bataev foo(); 28460e51c48SAlexey Bataev #pragma omp master taskloop reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} 28560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 28660e51c48SAlexey Bataev foo(); 28760e51c48SAlexey Bataev #pragma omp 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'}} 28860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 28960e51c48SAlexey Bataev foo(); 29060e51c48SAlexey Bataev #pragma omp 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}} 29160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 29260e51c48SAlexey Bataev foo(); 29360e51c48SAlexey Bataev #pragma omp master taskloop reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} 29460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 29560e51c48SAlexey Bataev foo(); 29660e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}} 29760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 29860e51c48SAlexey Bataev foo(); 29960e51c48SAlexey Bataev #pragma omp master taskloop reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}} 30060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 30160e51c48SAlexey Bataev foo(); 30260e51c48SAlexey Bataev #pragma omp master taskloop reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} 30360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 30460e51c48SAlexey Bataev foo(); 30560e51c48SAlexey Bataev #pragma omp master taskloop reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}} 30660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 30760e51c48SAlexey Bataev foo(); 30860e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} 30960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 31060e51c48SAlexey Bataev foo(); 31160e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}} 31260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 31360e51c48SAlexey Bataev foo(); 31460e51c48SAlexey Bataev #pragma omp 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')}} 31560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 31660e51c48SAlexey Bataev foo(); 31760e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} 31860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 31960e51c48SAlexey Bataev foo(); 32060e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : o) // expected-error {{no viable overloaded '='}} 32160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 32260e51c48SAlexey Bataev foo(); 32360e51c48SAlexey Bataev #pragma omp master taskloop private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} 32460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 32560e51c48SAlexey Bataev foo(); 32660e51c48SAlexey Bataev #pragma omp parallel private(k) 32760e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} 32860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 32960e51c48SAlexey Bataev foo(); 33060e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}} 33160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 33260e51c48SAlexey Bataev foo(); 33360e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}} 33460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 33560e51c48SAlexey Bataev foo(); 33660e51c48SAlexey Bataev #pragma omp parallel shared(i) 33760e51c48SAlexey Bataev #pragma omp parallel reduction(min : i) 33860e51c48SAlexey Bataev #pragma omp master taskloop reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} 33960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 34060e51c48SAlexey Bataev foo(); 34160e51c48SAlexey Bataev #pragma omp parallel private(fl) 34260e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : fl) 34360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 34460e51c48SAlexey Bataev foo(); 34560e51c48SAlexey Bataev #pragma omp parallel reduction(* : fl) 34660e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : fl) 34760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 34860e51c48SAlexey Bataev foo(); 34960e51c48SAlexey Bataev static int m; 35060e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : m) // OK 35160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 35260e51c48SAlexey Bataev m++; 35360e51c48SAlexey Bataev #pragma omp master taskloop nogroup reduction(+ : m) // expected-error {{'reduction' clause cannot be used with 'nogroup' clause}} 35460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i) 35560e51c48SAlexey Bataev m++; 356*1c1d9d9dSAlexey Bataev #pragma omp master taskloop reduction(task, + : m) // omp45-error 2 {{expected expression}} omp45-warning {{missing ':' after reduction identifier - ignoring}} omp50-error {{'reduction' clause with 'task' modifier allowed only on non-simd parallel or worksharing constructs}} 357*1c1d9d9dSAlexey Bataev for (int i = 0; i < 10; ++i) 358*1c1d9d9dSAlexey Bataev m++; 35960e51c48SAlexey Bataev 36060e51c48SAlexey 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}} 36160e51c48SAlexey Bataev } 362