1 // RUN: %clang_cc1 -verify=expected,le45 -fopenmp -ferror-limit 200 %s -Wno-openmp-target -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,le45 -fopenmp-version=40 -fopenmp -ferror-limit 200 %s -Wno-openmp-target -Wuninitialized
3 // RUN: %clang_cc1 -verify=expected,le45 -fopenmp-version=45 -fopenmp -ferror-limit 200 %s -Wno-openmp-target -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected -fopenmp-version=50 -fopenmp -ferror-limit 200 %s -Wno-openmp-target -Wuninitialized
5 
6 // RUN: %clang_cc1 -verify=expected,le45 -fopenmp-simd -ferror-limit 200 %s -Wno-openmp-target -Wuninitialized
7 // RUN: %clang_cc1 -DCCODE -verify=expected,le45 -fopenmp -ferror-limit 200 -x c %s -Wno-openmp-target -Wuninitialized
8 #ifdef CCODE
9 void foo(int arg) {
10   const int n = 0;
11 
12   double marr[10][10][10];
13 
14   #pragma omp target teams map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
15   {}
16   #pragma omp target teams map(marr[:][0:][:])
17   {}
18   #pragma omp target teams map(marr[:][1:][:]) // expected-error {{array section does not specify contiguous storage}}
19   {}
20   #pragma omp target teams map(marr[:][n:][:])
21   {}
22 }
23 #else
24 template <typename T, int I>
25 struct SA {
26   static int ss;
27   #pragma omp threadprivate(ss) // expected-note {{defined as threadprivate or thread local}}
28   float a;
29   int b[12];
30   float *c;
31   T d;
32   float e[I];
33   T *f;
34   void func(int arg) {
35     #pragma omp target teams map(arg,a,d)
36     {}
37     #pragma omp target teams map(arg[2:2],a,d) // expected-error {{subscripted value is not an array or pointer}}
38     {}
39     #pragma omp target teams map(arg,a*2) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
40     {}
41     #pragma omp target teams map(arg,(c+1)[2]) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
42     {}
43     #pragma omp target teams map(arg,a[:2],d) // expected-error {{subscripted value is not an array or pointer}}
44     {}
45     #pragma omp target teams map(arg,a,d[:2]) // expected-error {{subscripted value is not an array or pointer}}
46     {}
47 
48     #pragma omp target teams map(to:ss) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
49     {}
50 
51     #pragma omp target teams map(to:b,e)
52     {}
53     #pragma omp target teams map(to:b,e) map(to:b) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
54     {}
55     #pragma omp target teams map(to:b[:2],e)
56     {}
57     #pragma omp target teams map(to:b,e[:])
58     {}
59     #pragma omp target teams map(b[-1:]) // expected-error {{array section must be a subset of the original array}}
60     {}
61     #pragma omp target teams map(b[:-1]) // expected-error {{section length is evaluated to a negative value -1}}
62     {}
63     #pragma omp target teams map(b[true:true])
64     {}
65 
66     #pragma omp target teams map(always, tofrom: c,f)
67     {}
68     #pragma omp target teams map(always, tofrom: c[1:2],f)
69     {}
70     #pragma omp target teams map(always, tofrom: c,f[1:2])
71     {}
72     #pragma omp target teams map(always, tofrom: c[:],f)   // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
73     {}
74     #pragma omp target teams map(always, tofrom: c,f[:])   // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
75     {}
76     return;
77   }
78 };
79 
80 struct SB {
81   unsigned A;
82   unsigned B;
83   float Arr[100];
84   float *Ptr;
85   float *foo() {
86     return &Arr[0];
87   }
88 };
89 
90 struct SC {
91   unsigned A : 2;
92   unsigned B : 3;
93   unsigned C;
94   unsigned D;
95   float Arr[100];
96   SB S;
97   SB ArrS[100];
98   SB *PtrS;
99   SB *&RPtrS;
100   float *Ptr;
101 
102   SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
103 };
104 
105 union SD {
106   unsigned A;
107   float B;
108 };
109 
110 void SAclient(int arg) {
111   SA<int,123> s;
112   s.func(arg); // expected-note {{in instantiation of member function}}
113   double marr[10][10][10];
114   double marr2[5][10][1];
115   double mvla[5][arg][10];
116   double ***mptr;
117   const int n = 0;
118   const int m = 1;
119   double mvla2[5][arg][m+n+10];
120 
121   SB *p;
122 
123   SD u;
124   SC r(p),t(p);
125   #pragma omp target teams map(r)
126   {}
127   #pragma omp target teams map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
128   {}
129   #pragma omp target teams map(marr[:][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
130   {}
131   #pragma omp target teams map(marr[2][3][0:2])
132   {}
133   #pragma omp target teams map(marr[:][:][:])
134   {}
135   #pragma omp target teams map(marr[:2][:][:])
136   {}
137   #pragma omp target teams map(marr[arg:][:][:])
138   {}
139   #pragma omp target teams map(marr[arg:])
140   {}
141   #pragma omp target teams map(marr[arg:][:arg][:]) // correct if arg is the size of dimension 2
142   {}
143   #pragma omp target teams map(marr[:arg][:])
144   {}
145   #pragma omp target teams map(marr[:arg][n:])
146   {}
147   #pragma omp target teams map(marr[:][:arg][n:]) // correct if arg is the size of  dimension 2
148   {}
149   #pragma omp target teams map(marr[:][:m][n:]) // expected-error {{array section does not specify contiguous storage}}
150   {}
151   #pragma omp target teams map(marr[n:m][:arg][n:])
152   {}
153   #pragma omp target teams map(marr[:2][:1][:]) // expected-error {{array section does not specify contiguous storage}}
154   {}
155   #pragma omp target teams map(marr[:2][1:][:]) // expected-error {{array section does not specify contiguous storage}}
156   {}
157   #pragma omp target teams map(marr[:2][:][:1]) // expected-error {{array section does not specify contiguous storage}}
158   {}
159   #pragma omp target teams map(marr[:2][:][1:]) // expected-error {{array section does not specify contiguous storage}}
160   {}
161   #pragma omp target teams map(marr[:1][:2][:])
162   {}
163   #pragma omp target teams map(marr[:1][0][:])
164   {}
165   #pragma omp target teams map(marr[:arg][:2][:]) // correct if arg is 1
166   {}
167   #pragma omp target teams map(marr[:1][3:1][:2])
168   {}
169   #pragma omp target teams map(marr[:1][3:arg][:2]) // correct if arg is 1
170   {}
171   #pragma omp target teams map(marr[:1][3:2][:2]) // expected-error {{array section does not specify contiguous storage}}
172   {}
173   #pragma omp target teams map(marr[:2][:10][:])
174   {}
175   #pragma omp target teams map(marr[:2][:][:5+5])
176   {}
177   #pragma omp target teams map(marr[:2][2+2-4:][0:5+5])
178   {}
179 
180   #pragma omp target teams map(marr[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
181   {}
182   #pragma omp target teams map(marr2[:1][:2][0])
183   {}
184 
185   #pragma omp target teams map(mvla[:1][:][0]) // correct if the size of dimension 2 is 1.
186   {}
187   #pragma omp target teams map(mvla[:2][:arg][:]) // correct if arg is the size of dimension 2.
188   {}
189   #pragma omp target teams map(mvla[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
190    {}
191   #pragma omp target teams map(mvla[1][2:arg][:])
192   {}
193   #pragma omp target teams map(mvla[:1][:][:])
194   {}
195   #pragma omp target teams map(mvla2[:1][:2][:11])
196   {}
197   #pragma omp target teams map(mvla2[:1][:2][:10]) // expected-error {{array section does not specify contiguous storage}}
198   {}
199 
200   #pragma omp target teams map(mptr[:2][2+2-4:1][0:5+5]) // expected-error {{array section does not specify contiguous storage}}
201   {}
202   #pragma omp target teams map(mptr[:1][:2-1][2:4-3])
203   {}
204   #pragma omp target teams map(mptr[:1][:arg][2:4-3]) // correct if arg is 1.
205   {}
206   #pragma omp target teams map(mptr[:1][:2-1][0:2])
207   {}
208   #pragma omp target teams map(mptr[:1][:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
209   {}
210   #pragma omp target teams map(mptr[:1][:][0:2]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
211   {}
212   #pragma omp target teams map(mptr[:2][:1][0:2]) // expected-error {{array section does not specify contiguous storage}}
213   {}
214 
215   #pragma omp target teams map(r.ArrS[0].B)
216   {}
217   #pragma omp target teams map(r.ArrS[:1].B) // expected-error {{OpenMP array section is not allowed here}}
218   {}
219   #pragma omp target teams map(r.ArrS[:arg].B) // expected-error {{OpenMP array section is not allowed here}}
220   {}
221   #pragma omp target teams map(r.ArrS[0].Arr[1:23])
222   {}
223   #pragma omp target teams map(r.ArrS[0].Arr[1:arg])
224   {}
225   #pragma omp target teams map(r.ArrS[0].Arr[arg:23])
226   {}
227   #pragma omp target teams map(r.ArrS[0].Error) // expected-error {{no member named 'Error' in 'SB'}}
228   {}
229   #pragma omp target teams map(r.ArrS[0].A, r.ArrS[1].A) // expected-error {{multiple array elements associated with the same variable are not allowed in map clauses of the same construct}} expected-note {{used here}}
230   {}
231   #pragma omp target teams map(r.ArrS[0].A, t.ArrS[1].A)
232   {}
233   #pragma omp target teams map(r.PtrS[0], r.PtrS->B) // expected-error {{same pointer dereferenced in multiple different ways in map clause expressions}} expected-note {{used here}}
234   {}
235   #pragma omp target teams map(r.PtrS, r.PtrS->B) // expected-error {{pointer cannot be mapped along with a section derived from itself}} expected-note {{used here}}
236   {}
237   #pragma omp target teams map(r.PtrS->A, r.PtrS->B)
238   {}
239   #pragma omp target teams map(r.RPtrS[0], r.RPtrS->B) // expected-error {{same pointer dereferenced in multiple different ways in map clause expressions}} expected-note {{used here}}
240   {}
241   #pragma omp target teams map(r.RPtrS, r.RPtrS->B) // expected-error {{pointer cannot be mapped along with a section derived from itself}} expected-note {{used here}}
242   {}
243   #pragma omp target teams map(r.RPtrS->A, r.RPtrS->B)
244   {}
245   #pragma omp target teams map(r.S.Arr[:12])
246   {}
247   #pragma omp target teams map(r.S.foo()[:12]) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
248   {}
249   #pragma omp target teams map(r.C, r.D)
250   {}
251   #pragma omp target teams map(r.C, r.C) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
252   {}
253   #pragma omp target teams map(r.C) map(r.C) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
254   {}
255   #pragma omp target teams map(r.C, r.S)  // this would be an error only caught at runtime - Sema would have to make sure there is not way for the missing data between fields to be mapped somewhere else.
256   {}
257   #pragma omp target teams map(r, r.S)  // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
258   {}
259   #pragma omp target teams map(r.C, t.C)
260   {}
261   #pragma omp target teams map(r.A)   // expected-error {{bit fields cannot be used to specify storage in a 'map' clause}}
262   {}
263   #pragma omp target teams map(r.Arr)
264   {}
265   #pragma omp target teams map(r.Arr[3:5])
266   {}
267   #pragma omp target teams map(r.Ptr[3:5])
268   {}
269   #pragma omp target teams map(r.ArrS[3:5].A)   // expected-error {{OpenMP array section is not allowed here}}
270   {}
271   #pragma omp target teams map(r.ArrS[3:5].Arr[6:7])   // expected-error {{OpenMP array section is not allowed here}}
272   {}
273   #pragma omp target teams map(r.ArrS[3].Arr[6:7])
274   {}
275   #pragma omp target teams map(r.S.Arr[4:5])
276   {}
277   #pragma omp target teams map(r.S.Ptr[4:5])
278   {}
279   #pragma omp target teams map(r.S.Ptr[:])  // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
280   {}
281   #pragma omp target teams map((p+1)->A)  // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
282   {}
283   #pragma omp target teams map(u.B)  // expected-error {{mapping of union members is not allowed}}
284   {}
285 
286   #pragma omp target data map(to: r.C) //expected-note {{used here}}
287   {
288     #pragma omp target teams map(r.D)  // expected-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}}
289     {}
290   }
291 
292   #pragma omp target data map(to: t.Ptr) //expected-note {{used here}}
293   {
294     #pragma omp target teams map(t.Ptr[:23])  // expected-error {{pointer cannot be mapped along with a section derived from itself}}
295     {}
296   }
297 
298   #pragma omp target data map(to: t.C, t.D)
299   {
300   #pragma omp target data map(to: t.C)
301   {
302     #pragma omp target teams map(t.D)
303     {}
304   }
305   }
306 
307   #pragma omp target data map(to: t)
308   {
309   #pragma omp target data map(to: t.C)
310   {
311     #pragma omp target teams map(t.D)
312     {}
313   }
314   }
315 }
316 void foo() {
317 }
318 
319 bool foobool(int argc) {
320   return argc;
321 }
322 
323 struct S1; // expected-note 2 {{declared here}}
324 extern S1 a;
325 class S2 {
326   mutable int a;
327 public:
328   S2():a(0) { }
329   S2(S2 &s2):a(s2.a) { }
330   static float S2s;
331   static const float S2sc;
332 };
333 const float S2::S2sc = 0;
334 const S2 b;
335 const S2 ba[5];
336 class S3 {
337   int a;
338 public:
339   S3():a(0) { }
340   S3(S3 &s3):a(s3.a) { }
341 };
342 const S3 c;
343 const S3 ca[5];
344 extern const int f;
345 class S4 {
346   int a;
347   S4();
348   S4(const S4 &s4);
349 public:
350   S4(int v):a(v) { }
351 };
352 class S5 {
353   int a;
354   S5():a(0) {}
355   S5(const S5 &s5):a(s5.a) { }
356 public:
357   S5(int v):a(v) { }
358 };
359 
360 template <class T>
361 struct S6;
362 
363 template<>
364 struct S6<int>
365 {
366    virtual void foo();
367 };
368 
369 S3 h;
370 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
371 
372 typedef int from;
373 
374 template <typename T, int I> // expected-note {{declared here}}
375 T tmain(T argc) {
376   const T d = 5;
377   const T da[5] = { 0 };
378   S4 e(4);
379   S5 g(5);
380   T i, t[20];
381   T &j = i;
382   T *k = &j;
383   T x;
384   T y;
385   T to, tofrom, always;
386   const T (&l)[5] = da;
387 #pragma omp target teams map // expected-error {{expected '(' after 'map'}}
388   {}
389 #pragma omp target teams map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
390   {}
391 #pragma omp target teams map() // expected-error {{expected expression}}
392   {}
393 #pragma omp target teams map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
394   {}
395 #pragma omp target teams map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
396   {}
397 #pragma omp target teams map(to:) // expected-error {{expected expression}}
398   {}
399 #pragma omp target teams map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
400   {}
401 #pragma omp target teams map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
402   {}
403 #pragma omp target teams map(x)
404   foo();
405 #pragma omp target teams map(tofrom: t[:I])
406   foo();
407 #pragma omp target teams map(T: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} expected-error {{incomplete type 'S1' where a complete type is required}}
408   foo();
409 #pragma omp target teams map(T) // expected-error {{'T' does not refer to a value}}
410   foo();
411 #pragma omp target teams map(I) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
412   foo();
413 #pragma omp target teams map(S2::S2s)
414   foo();
415 #pragma omp target teams map(S2::S2sc)
416   foo();
417 #pragma omp target teams map(x)
418   foo();
419 #pragma omp target teams map(to: x)
420   foo();
421 #pragma omp target teams map(to: to)
422   foo();
423 #pragma omp target teams map(to)
424   foo();
425 #pragma omp target teams map(to, x)
426   foo();
427 
428 #pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
429 #pragma omp target data map(tofrom: argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
430 #pragma omp target data map(argc)
431 #pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
432 #pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
433 #pragma omp target data map(ba)
434 #pragma omp target data map(ca)
435 #pragma omp target data map(da)
436 #pragma omp target data map(S2::S2s)
437 #pragma omp target data map(S2::S2sc)
438 #pragma omp target data map(e, g)
439 #pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
440 #pragma omp target data map(k) map(k) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}}
441 #pragma omp target teams map(k), map(k[:5]) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}} expected-note 2 {{used here}}
442   foo();
443 
444 #pragma omp target data map(da)
445 #pragma omp target teams map(da[:4])
446   foo();
447 
448 #pragma omp target data map(k, j, l) // expected-note 2 {{used here}}
449 #pragma omp target data map(k[:4]) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}}
450 #pragma omp target data map(j)
451 #pragma omp target teams map(l) map(l[:5]) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}}
452   foo();
453 
454 #pragma omp target data map(k[:4], j, l[:5]) // expected-note 2 {{used here}}
455 #pragma omp target data map(k) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}}
456 #pragma omp target data map(j)
457 #pragma omp target teams map(l)
458   foo();
459 
460 #pragma omp target data map(always, tofrom: x)
461 #pragma omp target data map(always: x) // expected-error {{missing map type}}
462 #pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}}
463 #pragma omp target data map(always, tofrom: always, tofrom, x)
464 #pragma omp target teams map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
465   foo();
466   return 0;
467 }
468 
469 int main(int argc, char **argv) {
470   const int d = 5;
471   const int da[5] = { 0 };
472   S4 e(4);
473   S5 g(5);
474   int i;
475   int &j = i;
476   int *k = &j;
477   S6<int> m;
478   int x;
479   int y;
480   int to, tofrom, always;
481   const int (&l)[5] = da;
482 #pragma omp target data map // expected-error {{expected '(' after 'map'}} expected-error {{expected at least one 'map' or 'use_device_ptr' clause for '#pragma omp target data'}}
483 #pragma omp target data map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
484 #pragma omp target data map() // expected-error {{expected expression}}
485 #pragma omp target data map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
486 #pragma omp target data map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
487 #pragma omp target data map(to:) // expected-error {{expected expression}}
488 #pragma omp target data map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
489 #pragma omp target data map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
490 #pragma omp target teams map(x)
491   foo();
492 
493 #pragma omp target teams map(to: x)
494   foo();
495 #pragma omp target teams map(to: to)
496   foo();
497 #pragma omp target teams map(to)
498   foo();
499 #pragma omp target teams map(to, x)
500   foo();
501 
502 #pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
503 #pragma omp target data map(tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{xpected expression containing only member accesses and/or array sections based on named variables}}
504 #pragma omp target data map(argc)
505 #pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
506 #pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
507 #pragma omp target data map(argv[1])
508 #pragma omp target data map(ba)
509 #pragma omp target data map(ca)
510 #pragma omp target data map(da)
511 #pragma omp target data map(S2::S2s)
512 #pragma omp target data map(S2::S2sc)
513 #pragma omp target data map(e, g)
514 #pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
515 #pragma omp target data map(k), map(k) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
516 #pragma omp target teams map(k), map(k[:5]) // expected-error {{pointer cannot be mapped along with a section derived from itself}} expected-note {{used here}}
517   foo();
518 
519 #pragma omp target data map(da)
520 #pragma omp target teams map(da[:4])
521   foo();
522 
523 #pragma omp target data map(k, j, l) // expected-note {{used here}}
524 #pragma omp target data map(k[:4]) // expected-error {{pointer cannot be mapped along with a section derived from itself}}
525 #pragma omp target data map(j)
526 #pragma omp target teams map(l) map(l[:5]) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
527   foo();
528 
529 #pragma omp target data map(k[:4], j, l[:5]) // expected-note {{used here}}
530 #pragma omp target data map(k) // expected-error {{pointer cannot be mapped along with a section derived from itself}}
531 #pragma omp target data map(j)
532 #pragma omp target teams map(l)
533   foo();
534 
535 #pragma omp target data map(always, tofrom: x)
536 #pragma omp target data map(always: x) // expected-error {{missing map type}}
537 #pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}}
538 #pragma omp target data map(always, tofrom: always, tofrom, x)
539 #pragma omp target teams map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
540   foo();
541 
542 #pragma omp target teams private(j) map(j) // le45-error {{private variable cannot be in a map clause in '#pragma omp target teams' directive}}  le45-note {{defined as private}}
543   {}
544 
545 #pragma omp target teams firstprivate(j) map(j) // le45-error {{firstprivate variable cannot be in a map clause in '#pragma omp target teams' directive}} le45-note {{defined as firstprivate}}
546   {}
547 
548 #pragma omp target teams map(m)
549   {}
550 
551   return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}
552 }
553 #endif
554