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