160e51c48SAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
260e51c48SAlexey Bataev 
360e51c48SAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
460e51c48SAlexey Bataev 
560e51c48SAlexey Bataev typedef void **omp_allocator_handle_t;
6*8026394dSAlexey Bataev extern const omp_allocator_handle_t omp_null_allocator;
760e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_default_mem_alloc;
860e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
960e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_const_mem_alloc;
1060e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
1160e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
1260e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
1360e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_pteam_mem_alloc;
1460e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_thread_mem_alloc;
1560e51c48SAlexey Bataev 
foo()1660e51c48SAlexey Bataev void foo() {
1760e51c48SAlexey Bataev }
1860e51c48SAlexey Bataev 
foobool(int argc)1960e51c48SAlexey Bataev bool foobool(int argc) {
2060e51c48SAlexey Bataev   return argc;
2160e51c48SAlexey Bataev }
2260e51c48SAlexey Bataev 
xxx(int argc)2360e51c48SAlexey Bataev void xxx(int argc) {
2460e51c48SAlexey Bataev   int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
2560e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
2660e51c48SAlexey Bataev   for (int i = 0; i < 10; ++i)
2760e51c48SAlexey Bataev     ;
2860e51c48SAlexey Bataev }
2960e51c48SAlexey Bataev 
3060e51c48SAlexey Bataev struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
3160e51c48SAlexey Bataev extern S1 a;
3260e51c48SAlexey Bataev class S2 {
3360e51c48SAlexey Bataev   mutable int a;
3460e51c48SAlexey Bataev 
3560e51c48SAlexey Bataev public:
S2()3660e51c48SAlexey Bataev   S2() : a(0) {}
S2(const S2 & s2)3760e51c48SAlexey Bataev   S2(const S2 &s2) : a(s2.a) {}
3860e51c48SAlexey Bataev   static float S2s;
3960e51c48SAlexey Bataev   static const float S2sc;
4060e51c48SAlexey Bataev };
4160e51c48SAlexey Bataev const float S2::S2sc = 0;
4260e51c48SAlexey Bataev const S2 b;
4360e51c48SAlexey Bataev const S2 ba[5];
4460e51c48SAlexey Bataev class S3 {
4560e51c48SAlexey Bataev   int a;
4660e51c48SAlexey Bataev   S3 &operator=(const S3 &s3);
4760e51c48SAlexey Bataev 
4860e51c48SAlexey Bataev public:
S3()4960e51c48SAlexey Bataev   S3() : a(0) {} // expected-note 2 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
S3(S3 & s3)5060e51c48SAlexey Bataev   S3(S3 &s3) : a(s3.a) {} // expected-note 2 {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
5160e51c48SAlexey Bataev };
5260e51c48SAlexey Bataev const S3 c;
5360e51c48SAlexey Bataev const S3 ca[5];
5460e51c48SAlexey Bataev extern const int f;
5560e51c48SAlexey Bataev class S4 {
5660e51c48SAlexey Bataev   int a;
5760e51c48SAlexey Bataev   S4();
5860e51c48SAlexey Bataev   S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}}
5960e51c48SAlexey Bataev 
6060e51c48SAlexey Bataev public:
S4(int v)6160e51c48SAlexey Bataev   S4(int v) : a(v) {}
6260e51c48SAlexey Bataev };
6360e51c48SAlexey Bataev class S5 {
6460e51c48SAlexey Bataev   int a;
S5(const S5 & s5)6560e51c48SAlexey Bataev   S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}}
6660e51c48SAlexey Bataev 
6760e51c48SAlexey Bataev public:
S5()6860e51c48SAlexey Bataev   S5() : a(0) {}
S5(int v)6960e51c48SAlexey Bataev   S5(int v) : a(v) {}
7060e51c48SAlexey Bataev };
7160e51c48SAlexey Bataev class S6 {
7260e51c48SAlexey Bataev   int a;
S6()7360e51c48SAlexey Bataev   S6() : a(0) {}
7460e51c48SAlexey Bataev 
7560e51c48SAlexey Bataev public:
S6(const S6 & s6)7660e51c48SAlexey Bataev   S6(const S6 &s6) : a(s6.a) {}
S6(int v)7760e51c48SAlexey Bataev   S6(int v) : a(v) {}
7860e51c48SAlexey Bataev };
7960e51c48SAlexey Bataev 
8060e51c48SAlexey Bataev S3 h;
8160e51c48SAlexey Bataev #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
8260e51c48SAlexey Bataev 
8360e51c48SAlexey Bataev template <class I, class C>
foomain(int argc,char ** argv)8460e51c48SAlexey Bataev int foomain(int argc, char **argv) {
8560e51c48SAlexey Bataev   I e(4);
8660e51c48SAlexey Bataev   C g(5);
8760e51c48SAlexey Bataev   int i, z;
8860e51c48SAlexey Bataev   int &j = i;
8960e51c48SAlexey Bataev #pragma omp parallel
9060e51c48SAlexey Bataev #pragma omp master taskloop firstprivate // expected-error {{expected '(' after 'firstprivate'}}
9160e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
9260e51c48SAlexey Bataev     ++k;
9360e51c48SAlexey Bataev #pragma omp parallel
9460e51c48SAlexey Bataev #pragma omp master taskloop firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
9560e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
9660e51c48SAlexey Bataev     ++k;
9760e51c48SAlexey Bataev #pragma omp parallel
9860e51c48SAlexey Bataev #pragma omp master taskloop firstprivate() // expected-error {{expected expression}}
9960e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
10060e51c48SAlexey Bataev     ++k;
10160e51c48SAlexey Bataev #pragma omp parallel
10260e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
10360e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
10460e51c48SAlexey Bataev     ++k;
10560e51c48SAlexey Bataev #pragma omp parallel
10660e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
10760e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
10860e51c48SAlexey Bataev     ++k;
10960e51c48SAlexey Bataev #pragma omp parallel
11060e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
11160e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
11260e51c48SAlexey Bataev     ++k;
11360e51c48SAlexey Bataev #pragma omp parallel
11460e51c48SAlexey Bataev #pragma omp master taskloop allocate(omp_thread_mem_alloc: argc) firstprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'master taskloop' directive}}
11560e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
11660e51c48SAlexey Bataev     ++k;
11760e51c48SAlexey Bataev #pragma omp parallel
11860e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
11960e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
12060e51c48SAlexey Bataev     ++k;
12160e51c48SAlexey Bataev #pragma omp parallel
12260e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}}
12360e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
12460e51c48SAlexey Bataev     ++k;
12560e51c48SAlexey Bataev #pragma omp parallel
12660e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(argv[1]) // expected-error {{expected variable name}}
12760e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
12860e51c48SAlexey Bataev     ++k;
12960e51c48SAlexey Bataev #pragma omp parallel
13060e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(z, e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
13160e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
13260e51c48SAlexey Bataev     ++k;
13360e51c48SAlexey Bataev #pragma omp parallel
13460e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
13560e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
13660e51c48SAlexey Bataev     ++k;
13760e51c48SAlexey Bataev #pragma omp parallel
13860e51c48SAlexey Bataev   {
13960e51c48SAlexey Bataev     int v = 0;
14060e51c48SAlexey Bataev     int i;
14160e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i)
14260e51c48SAlexey Bataev     for (int k = 0; k < argc; ++k) {
14360e51c48SAlexey Bataev       i = k;
14460e51c48SAlexey Bataev       v += i;
14560e51c48SAlexey Bataev     }
14660e51c48SAlexey Bataev   }
14760e51c48SAlexey Bataev #pragma omp parallel shared(i)
14860e51c48SAlexey Bataev #pragma omp parallel private(i)
14960e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(j)
15060e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
15160e51c48SAlexey Bataev     ++k;
15260e51c48SAlexey Bataev #pragma omp parallel
15360e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i)
15460e51c48SAlexey Bataev   for (int k = 0; k < argc; ++k)
15560e51c48SAlexey Bataev     ++k;
15660e51c48SAlexey Bataev #pragma omp parallel
15760e51c48SAlexey Bataev #pragma omp master taskloop lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
15860e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
15960e51c48SAlexey Bataev     foo();
16060e51c48SAlexey Bataev #pragma omp parallel private(i)
16160e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i) // expected-note 2 {{defined as firstprivate}}
16260e51c48SAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error 2 {{loop iteration variable in the associated loop of 'omp master taskloop' directive may not be firstprivate, predetermined as private}}
16360e51c48SAlexey Bataev     foo();
16460e51c48SAlexey Bataev #pragma omp parallel reduction(+ : i)  // expected-note {{defined as reduction}}
16560e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i) // expected-note {{defined as firstprivate}} expected-error {{argument of a reduction clause of a parallel construct must not appear in a firstprivate clause on a task construct}}
16660e51c48SAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp master taskloop' directive may not be firstprivate, predetermined as private}}
16760e51c48SAlexey Bataev     foo();
16860e51c48SAlexey Bataev   return 0;
16960e51c48SAlexey Bataev }
17060e51c48SAlexey Bataev 
bar(S4 a[2])17160e51c48SAlexey Bataev void bar(S4 a[2]) {
17260e51c48SAlexey Bataev #pragma omp parallel
17360e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(a)
17460e51c48SAlexey Bataev   for (int i = 0; i < 2; ++i)
17560e51c48SAlexey Bataev     foo();
17660e51c48SAlexey Bataev }
17760e51c48SAlexey Bataev 
17860e51c48SAlexey Bataev namespace A {
17960e51c48SAlexey Bataev double x;
18060e51c48SAlexey Bataev #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
18160e51c48SAlexey Bataev }
18260e51c48SAlexey Bataev namespace B {
18360e51c48SAlexey Bataev using A::x;
18460e51c48SAlexey Bataev }
18560e51c48SAlexey Bataev 
main(int argc,char ** argv)18660e51c48SAlexey Bataev int main(int argc, char **argv) {
18760e51c48SAlexey Bataev   const int d = 5;
18860e51c48SAlexey Bataev   const int da[5] = {0};
18960e51c48SAlexey Bataev   S4 e(4);
19060e51c48SAlexey Bataev   S5 g(5);
19160e51c48SAlexey Bataev   S3 m;
19260e51c48SAlexey Bataev   S6 n(2);
19360e51c48SAlexey Bataev   int i;
19460e51c48SAlexey Bataev   int &j = i;
19560e51c48SAlexey Bataev #pragma omp parallel
19660e51c48SAlexey Bataev #pragma omp master taskloop firstprivate // expected-error {{expected '(' after 'firstprivate'}}
19760e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
19860e51c48SAlexey Bataev     foo();
19960e51c48SAlexey Bataev #pragma omp parallel
20060e51c48SAlexey Bataev #pragma omp master taskloop firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
20160e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
20260e51c48SAlexey Bataev     foo();
20360e51c48SAlexey Bataev #pragma omp parallel
20460e51c48SAlexey Bataev #pragma omp master taskloop firstprivate() // expected-error {{expected expression}}
20560e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
20660e51c48SAlexey Bataev     foo();
20760e51c48SAlexey Bataev #pragma omp parallel
20860e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
20960e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
21060e51c48SAlexey Bataev     foo();
21160e51c48SAlexey Bataev #pragma omp parallel
21260e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
21360e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
21460e51c48SAlexey Bataev     foo();
21560e51c48SAlexey Bataev #pragma omp parallel
21660e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
21760e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
21860e51c48SAlexey Bataev     foo();
21960e51c48SAlexey Bataev #pragma omp parallel
22060e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(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 '('}}
22160e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
22260e51c48SAlexey Bataev     foo();
22360e51c48SAlexey Bataev #pragma omp parallel
22460e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
22560e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
22660e51c48SAlexey Bataev     foo();
22760e51c48SAlexey Bataev #pragma omp parallel
22860e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{no matching constructor for initialization of 'S3'}}
22960e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
23060e51c48SAlexey Bataev     foo();
23160e51c48SAlexey Bataev #pragma omp parallel
23260e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(argv[1]) // expected-error {{expected variable name}}
23360e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
23460e51c48SAlexey Bataev     foo();
23560e51c48SAlexey Bataev #pragma omp parallel
23660e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(2 * 2) // expected-error {{expected variable name}}
23760e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
23860e51c48SAlexey Bataev     foo();
23960e51c48SAlexey Bataev #pragma omp parallel
24060e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(ba) // OK
24160e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
24260e51c48SAlexey Bataev     foo();
24360e51c48SAlexey Bataev #pragma omp parallel
24460e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
24560e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
24660e51c48SAlexey Bataev     foo();
24760e51c48SAlexey Bataev #pragma omp parallel
24860e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(da) // OK
24960e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
25060e51c48SAlexey Bataev     foo();
25160e51c48SAlexey Bataev   int xa;
25260e51c48SAlexey Bataev #pragma omp parallel
25360e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(xa) // OK
25460e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
25560e51c48SAlexey Bataev     foo();
25660e51c48SAlexey Bataev #pragma omp parallel
25760e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(S2::S2s) // OK
25860e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
25960e51c48SAlexey Bataev     foo();
26060e51c48SAlexey Bataev #pragma omp parallel
26160e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(S2::S2sc) // OK
26260e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
26360e51c48SAlexey Bataev     foo();
26460e51c48SAlexey Bataev #pragma omp parallel
26560e51c48SAlexey Bataev #pragma omp master taskloop safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp master taskloop'}}
26660e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
26760e51c48SAlexey Bataev     foo();
26860e51c48SAlexey Bataev #pragma omp parallel
26960e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
27060e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
27160e51c48SAlexey Bataev     foo();
27260e51c48SAlexey Bataev #pragma omp parallel
27360e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(m) // OK
27460e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
27560e51c48SAlexey Bataev     foo();
27660e51c48SAlexey Bataev #pragma omp parallel
27760e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
27860e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
27960e51c48SAlexey Bataev     foo();
28060e51c48SAlexey Bataev #pragma omp parallel
28160e51c48SAlexey Bataev #pragma omp master taskloop private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}
28260e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
28360e51c48SAlexey Bataev     foo();
28460e51c48SAlexey Bataev #pragma omp parallel
28560e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i) // expected-note {{defined as firstprivate}}
28660e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)    // expected-error {{loop iteration variable in the associated loop of 'omp master taskloop' directive may not be firstprivate, predetermined as private}}
28760e51c48SAlexey Bataev     foo();
28860e51c48SAlexey Bataev #pragma omp parallel shared(xa)
28960e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(xa) // OK: may be firstprivate
29060e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
29160e51c48SAlexey Bataev     foo();
29260e51c48SAlexey Bataev #pragma omp parallel
29360e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(j)
29460e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
29560e51c48SAlexey Bataev     foo();
29660e51c48SAlexey Bataev #pragma omp parallel
29760e51c48SAlexey Bataev #pragma omp master taskloop lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
29860e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
29960e51c48SAlexey Bataev     foo();
30060e51c48SAlexey Bataev #pragma omp parallel
30160e51c48SAlexey Bataev #pragma omp master taskloop lastprivate(n) firstprivate(n) // OK
30260e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
30360e51c48SAlexey Bataev     foo();
30460e51c48SAlexey Bataev #pragma omp parallel
30560e51c48SAlexey Bataev   {
30660e51c48SAlexey Bataev     int v = 0;
30760e51c48SAlexey Bataev     int i;
30860e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i)
30960e51c48SAlexey Bataev     for (int k = 0; k < argc; ++k) {
31060e51c48SAlexey Bataev       i = k;
31160e51c48SAlexey Bataev       v += i;
31260e51c48SAlexey Bataev     }
31360e51c48SAlexey Bataev   }
31460e51c48SAlexey Bataev #pragma omp parallel private(i)
31560e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i) // expected-note {{defined as firstprivate}}
31660e51c48SAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp master taskloop' directive may not be firstprivate, predetermined as private}}
31760e51c48SAlexey Bataev     foo();
31860e51c48SAlexey Bataev #pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
31960e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i) //expected-error {{argument of a reduction clause of a parallel construct must not appear in a firstprivate clause on a task construct}}
32060e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
32160e51c48SAlexey Bataev     foo();
32260e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(i) //expected-note {{defined as firstprivate}}
32360e51c48SAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp master taskloop' directive may not be firstprivate, predetermined as private}}
32460e51c48SAlexey Bataev     foo();
32560e51c48SAlexey Bataev #pragma omp parallel
32660e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
32760e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
32860e51c48SAlexey Bataev     foo();
32960e51c48SAlexey Bataev   static int si;
33060e51c48SAlexey Bataev #pragma omp master taskloop firstprivate(si) // OK
33160e51c48SAlexey Bataev   for (i = 0; i < argc; ++i)
33260e51c48SAlexey Bataev     si = i + 1;
33360e51c48SAlexey Bataev 
33460e51c48SAlexey Bataev   return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}}
33560e51c48SAlexey Bataev }
33660e51c48SAlexey Bataev 
337