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