1*38bcd483SFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
2*38bcd483SFazlay Rabbi 
3*38bcd483SFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
4*38bcd483SFazlay Rabbi 
5*38bcd483SFazlay Rabbi typedef void **omp_allocator_handle_t;
6*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_null_allocator;
7*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_default_mem_alloc;
8*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
9*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_const_mem_alloc;
10*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
11*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
12*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
13*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_pteam_mem_alloc;
14*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_thread_mem_alloc;
15*38bcd483SFazlay Rabbi 
xxx(int argc)16*38bcd483SFazlay Rabbi void xxx(int argc) {
17*38bcd483SFazlay Rabbi   int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
18*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
19*38bcd483SFazlay Rabbi   for (i = 0; i < 10; ++i)
20*38bcd483SFazlay Rabbi     ;
21*38bcd483SFazlay Rabbi }
22*38bcd483SFazlay Rabbi 
23*38bcd483SFazlay Rabbi namespace X {
24*38bcd483SFazlay Rabbi   int x;
25*38bcd483SFazlay Rabbi };
26*38bcd483SFazlay Rabbi 
27*38bcd483SFazlay Rabbi struct B {
28*38bcd483SFazlay Rabbi   static int ib; // expected-note {{'B::ib' declared here}}
bfooB29*38bcd483SFazlay Rabbi   static int bfoo() { return 8; }
30*38bcd483SFazlay Rabbi };
31*38bcd483SFazlay Rabbi 
bfoo()32*38bcd483SFazlay Rabbi int bfoo() { return 4; }
33*38bcd483SFazlay Rabbi 
34*38bcd483SFazlay Rabbi int z;
35*38bcd483SFazlay Rabbi const int C1 = 1;
36*38bcd483SFazlay Rabbi const int C2 = 2;
test_linear_colons()37*38bcd483SFazlay Rabbi void test_linear_colons()
38*38bcd483SFazlay Rabbi {
39*38bcd483SFazlay Rabbi   int B = 0;
40*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(B:bfoo())
41*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
42*38bcd483SFazlay Rabbi   // expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'}}
43*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(B::ib:B:bfoo())
44*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
45*38bcd483SFazlay Rabbi   // expected-error@+1 {{use of undeclared identifier 'ib'; did you mean 'B::ib'}}
46*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(B:ib)
47*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
48*38bcd483SFazlay Rabbi   // expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'?}}
49*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(z:B:ib)
50*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
51*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(B:B::bfoo())
52*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
53*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(X::x : ::z)
54*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
55*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(B,::z, X::x)
56*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
57*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(::z)
58*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
59*38bcd483SFazlay Rabbi   // expected-error@+1 {{expected variable name}}
60*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(B::bfoo())
61*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
62*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(B::ib,B:C1+C2)
63*38bcd483SFazlay Rabbi   for (int i = 0; i < 10; ++i) ;
64*38bcd483SFazlay Rabbi }
65*38bcd483SFazlay Rabbi 
test_template(T * arr,N num)66*38bcd483SFazlay Rabbi template<int L, class T, class N> T test_template(T* arr, N num) {
67*38bcd483SFazlay Rabbi   N i;
68*38bcd483SFazlay Rabbi   T sum = (T)0;
69*38bcd483SFazlay Rabbi   T ind2 = - num * L; // expected-note {{'ind2' defined here}}
70*38bcd483SFazlay Rabbi   // expected-error@+1 {{argument of a linear clause should be of integral or pointer type}}
71*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd linear(ind2:L)
72*38bcd483SFazlay Rabbi   for (i = 0; i < num; ++i) {
73*38bcd483SFazlay Rabbi     T cur = arr[(int)ind2];
74*38bcd483SFazlay Rabbi     ind2 += L;
75*38bcd483SFazlay Rabbi     sum += cur;
76*38bcd483SFazlay Rabbi   }
77*38bcd483SFazlay Rabbi   return T();
78*38bcd483SFazlay Rabbi }
79*38bcd483SFazlay Rabbi 
test_warn()80*38bcd483SFazlay Rabbi template<int LEN> int test_warn() {
81*38bcd483SFazlay Rabbi   int ind2 = 0;
82*38bcd483SFazlay Rabbi   // expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
83*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(ind2:LEN)
84*38bcd483SFazlay Rabbi   for (int i = 0; i < 100; i++) {
85*38bcd483SFazlay Rabbi     ind2 += LEN;
86*38bcd483SFazlay Rabbi   }
87*38bcd483SFazlay Rabbi   return ind2;
88*38bcd483SFazlay Rabbi }
89*38bcd483SFazlay Rabbi 
90*38bcd483SFazlay Rabbi struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
91*38bcd483SFazlay Rabbi extern S1 a;
92*38bcd483SFazlay Rabbi class S2 {
93*38bcd483SFazlay Rabbi   mutable int a;
94*38bcd483SFazlay Rabbi public:
S2()95*38bcd483SFazlay Rabbi   S2():a(0) { }
96*38bcd483SFazlay Rabbi };
97*38bcd483SFazlay Rabbi const S2 b; // expected-note 2 {{'b' defined here}}
98*38bcd483SFazlay Rabbi const S2 ba[5];
99*38bcd483SFazlay Rabbi class S3 {
100*38bcd483SFazlay Rabbi   int a;
101*38bcd483SFazlay Rabbi public:
S3()102*38bcd483SFazlay Rabbi   S3():a(0) { }
103*38bcd483SFazlay Rabbi };
104*38bcd483SFazlay Rabbi const S3 ca[5];
105*38bcd483SFazlay Rabbi class S4 {
106*38bcd483SFazlay Rabbi   int a;
107*38bcd483SFazlay Rabbi   S4();
108*38bcd483SFazlay Rabbi public:
S4(int v)109*38bcd483SFazlay Rabbi   S4(int v):a(v) { }
110*38bcd483SFazlay Rabbi };
111*38bcd483SFazlay Rabbi class S5 {
112*38bcd483SFazlay Rabbi   int a;
S5()113*38bcd483SFazlay Rabbi   S5():a(0) {}
114*38bcd483SFazlay Rabbi public:
S5(int v)115*38bcd483SFazlay Rabbi   S5(int v):a(v) { }
116*38bcd483SFazlay Rabbi };
117*38bcd483SFazlay Rabbi 
118*38bcd483SFazlay Rabbi S3 h;
119*38bcd483SFazlay Rabbi #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
120*38bcd483SFazlay Rabbi 
foomain(I argc,C ** argv)121*38bcd483SFazlay Rabbi template<class I, class C> int foomain(I argc, C **argv) {
122*38bcd483SFazlay Rabbi   I e(4);
123*38bcd483SFazlay Rabbi   I g(5);
124*38bcd483SFazlay Rabbi   int i, z;
125*38bcd483SFazlay Rabbi   int &j = i;
126*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear // expected-error {{expected '(' after 'linear'}}
127*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
128*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
129*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
130*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (val // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
131*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
132*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (uval( // expected-error {{expected expression}} expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
133*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
134*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (ref() // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
135*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
136*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (foo() // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
137*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
138*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear () // expected-error {{expected expression}}
139*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
140*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
141*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
142*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (val argc // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
143*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
144*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (val(argc, // expected-error {{expected expression}} expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
145*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
146*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
147*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
148*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argc : 5) 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 '('}}
149*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
150*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}}
151*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
152*38bcd483SFazlay Rabbi   // expected-error@+2 {{linear variable with incomplete type 'S1'}}
153*38bcd483SFazlay Rabbi   // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S2'}}
154*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (val(a, b):B::ib)
155*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
156*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argv[1]) // expected-error {{expected variable name}}
157*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
158*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(ref(e, g)) // expected-error 2 {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'ref'}}
159*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
160*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(h, z) // expected-error {{threadprivate or thread local variable cannot be linear}}
161*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
162*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(uval(i)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}}
163*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
164*38bcd483SFazlay Rabbi   #pragma omp parallel
165*38bcd483SFazlay Rabbi   {
166*38bcd483SFazlay Rabbi     int v = 0;
167*38bcd483SFazlay Rabbi     int i;
168*38bcd483SFazlay Rabbi     #pragma omp parallel masked taskloop simd allocate(omp_thread_mem_alloc: v) linear(v:i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'parallel masked taskloop simd' directive}}
169*38bcd483SFazlay Rabbi     for (int k = 0; k < argc; ++k) { i = k; v += i; }
170*38bcd483SFazlay Rabbi   }
171*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(ref(j))
172*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
173*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(uval(j))
174*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
175*38bcd483SFazlay Rabbi   int v = 0;
176*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(v:j)
177*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) { ++k; v += j; }
178*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(i)
179*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
180*38bcd483SFazlay Rabbi   return 0;
181*38bcd483SFazlay Rabbi }
182*38bcd483SFazlay Rabbi 
183*38bcd483SFazlay Rabbi namespace A {
184*38bcd483SFazlay Rabbi double x;
185*38bcd483SFazlay Rabbi #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
186*38bcd483SFazlay Rabbi }
187*38bcd483SFazlay Rabbi namespace C {
188*38bcd483SFazlay Rabbi using A::x;
189*38bcd483SFazlay Rabbi }
190*38bcd483SFazlay Rabbi 
linear_modifiers(int argc)191*38bcd483SFazlay Rabbi void linear_modifiers(int argc) {
192*38bcd483SFazlay Rabbi   int &f = argc;
193*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(f)
194*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
195*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(val(f))
196*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
197*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(uval(f))
198*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
199*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(ref(f))
200*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
201*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(foo(f)) // expected-error {{expected one of 'ref', val' or 'uval' modifiers}}
202*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
203*38bcd483SFazlay Rabbi }
204*38bcd483SFazlay Rabbi 
205*38bcd483SFazlay Rabbi int f;
main(int argc,char ** argv)206*38bcd483SFazlay Rabbi int main(int argc, char **argv) {
207*38bcd483SFazlay Rabbi   double darr[100];
208*38bcd483SFazlay Rabbi   // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
209*38bcd483SFazlay Rabbi   test_template<-4>(darr, 4);
210*38bcd483SFazlay Rabbi   // expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}}
211*38bcd483SFazlay Rabbi   test_warn<0>();
212*38bcd483SFazlay Rabbi 
213*38bcd483SFazlay Rabbi   S4 e(4); // expected-note {{'e' defined here}}
214*38bcd483SFazlay Rabbi   S5 g(5); // expected-note {{'g' defined here}}
215*38bcd483SFazlay Rabbi   int i, z;
216*38bcd483SFazlay Rabbi   int &j = i;
217*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(f) linear(f) // expected-error {{linear variable cannot be linear}} expected-note {{defined as linear}}
218*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
219*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear // expected-error {{expected '(' after 'linear'}}
220*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
221*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
222*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
223*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear () // expected-error {{expected expression}}
224*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
225*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (val // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
226*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
227*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (ref()) // expected-error {{expected expression}}
228*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
229*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (foo()) // expected-error {{expected expression}}
230*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
231*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
232*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
233*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
234*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
235*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
236*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
237*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argc, z)
238*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
239*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}}
240*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
241*38bcd483SFazlay Rabbi   // expected-error@+2 {{linear variable with incomplete type 'S1'}}
242*38bcd483SFazlay Rabbi   // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S2'}}
243*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(a, b)
244*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
245*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear (argv[1]) // expected-error {{expected variable name}}
246*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
247*38bcd483SFazlay Rabbi   // expected-error@+2 {{argument of a linear clause should be of integral or pointer type, not 'S4'}}
248*38bcd483SFazlay Rabbi   // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}}
249*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(val(e, g))
250*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
251*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}}
252*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
253*38bcd483SFazlay Rabbi   #pragma omp parallel
254*38bcd483SFazlay Rabbi   {
255*38bcd483SFazlay Rabbi     int i;
256*38bcd483SFazlay Rabbi     #pragma omp parallel masked taskloop simd linear(val(i))
257*38bcd483SFazlay Rabbi     for (int k = 0; k < argc; ++k) ++k;
258*38bcd483SFazlay Rabbi     #pragma omp parallel masked taskloop simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}}
259*38bcd483SFazlay Rabbi     for (int k = 0; k < argc; ++k) { ++k; i += 4; }
260*38bcd483SFazlay Rabbi   }
261*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(ref(j))
262*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
263*38bcd483SFazlay Rabbi   #pragma omp parallel masked taskloop simd linear(i)
264*38bcd483SFazlay Rabbi   for (int k = 0; k < argc; ++k) ++k;
265*38bcd483SFazlay Rabbi 
266*38bcd483SFazlay Rabbi   foomain<int,char>(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}
267*38bcd483SFazlay Rabbi   return 0;
268*38bcd483SFazlay Rabbi }
269*38bcd483SFazlay Rabbi 
270