[OpenACC] Treat 'delete' as a valid clause during parsing in C++ mode
[llvm-project.git] / clang / test / OpenMP / target_map_messages.cpp
blob10f46687d637922b383ff7c7a8dde424a995e8dc
1 // -fopenmp, -fno-openmp-extensions
2 // RUN: %clang_cc1 -verify=expected,ge50,lt51,lt60,omp,lt51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
3 // RUN: %clang_cc1 -verify=expected,lt50,lt51,lt60,omp,lt51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=40 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
4 // RUN: %clang_cc1 -verify=expected,lt50,lt51,lt60,omp,lt51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=45 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
5 // RUN: %clang_cc1 -verify=expected,ge50,lt51,lt60,omp,lt51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
6 // RUN: %clang_cc1 -verify=expected,ge50,ge51,lt60,omp,ge51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=51 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
7 // RUN: %clang_cc1 -verify=expected,ge50,ge51,ge52,lt60,omp,ge52-omp,omp52 -fopenmp -fno-openmp-extensions -fopenmp-version=52 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
8 // RUN: %clang_cc1 -verify=expected,ge50,ge52,ge60,omp,ge60-omp,omp60 -fopenmp -fno-openmp-extensions -fopenmp-version=60 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
9 // RUN: %clang_cc1 -DCCODE -verify -fopenmp -fno-openmp-extensions -ferror-limit 300 -x c %s -Wno-openmp -Wuninitialized -Wno-vla
11 // -fopenmp-simd, -fno-openmp-extensions
12 // RUN: %clang_cc1 -verify=expected,ge50,lt51,lt60,omp,lt51-omp -fopenmp-simd -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
13 // RUN: %clang_cc1 -verify=expected,lt50,lt51,lt60,omp,lt51-omp -fopenmp-simd -fno-openmp-extensions -fopenmp-version=40 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
14 // RUN: %clang_cc1 -verify=expected,lt50,lt51,lt60,omp,lt51-omp -fopenmp-simd -fno-openmp-extensions -fopenmp-version=45 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
15 // RUN: %clang_cc1 -verify=expected,ge50,lt51,lt60,omp,lt51-omp -fopenmp-simd -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
16 // RUN: %clang_cc1 -verify=expected,ge50,ge51,lt60,omp,ge51-omp -fopenmp-simd -fno-openmp-extensions -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
17 // RUN: %clang_cc1 -DCCODE -verify -fopenmp-simd -fno-openmp-extensions -ferror-limit 300 -x c %s -Wno-openmp-mapping -Wuninitialized -Wno-vla
19 // -fopenmp -fopenmp-extensions
20 // RUN: %clang_cc1 -verify=expected,ge50,lt51,lt60,ompx,lt51-ompx -fopenmp -fopenmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
21 // RUN: %clang_cc1 -verify=expected,lt50,lt51,lt60,ompx,lt51-ompx -fopenmp -fopenmp-extensions -fopenmp-version=40 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
22 // RUN: %clang_cc1 -verify=expected,lt50,lt51,lt60,ompx,lt51-ompx -fopenmp -fopenmp-extensions -fopenmp-version=45 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
23 // RUN: %clang_cc1 -verify=expected,ge50,lt51,lt60,ompx,lt51-ompx -fopenmp -fopenmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
24 // RUN: %clang_cc1 -verify=expected,ge50,ge51,lt60,ompx,ge51-ompx -fopenmp -fopenmp-extensions -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
25 // RUN: %clang_cc1 -DCCODE -verify -fopenmp -fopenmp-extensions -ferror-limit 300 -x c %s -Wno-openmp -Wuninitialized -Wno-vla
27 // -fopenmp-simd -fopenmp-extensions
28 // RUN: %clang_cc1 -verify=expected,ge50,lt51,lt60,ompx,lt51-ompx -fopenmp-simd -fopenmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
29 // RUN: %clang_cc1 -verify=expected,lt50,lt51,lt60,ompx,lt51-ompx -fopenmp-simd -fopenmp-extensions -fopenmp-version=40 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
30 // RUN: %clang_cc1 -verify=expected,lt50,lt51,lt60,ompx,lt51-ompx -fopenmp-simd -fopenmp-extensions -fopenmp-version=45 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
31 // RUN: %clang_cc1 -verify=expected,ge50,lt51,lt60,ompx,lt51-ompx -fopenmp-simd -fopenmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
32 // RUN: %clang_cc1 -verify=expected,ge50,ge51,lt60,ompx,ge51-ompx -fopenmp-simd -fopenmp-extensions -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
33 // RUN: %clang_cc1 -DCCODE -verify -fopenmp-simd -fopenmp-extensions -ferror-limit 300 -x c %s -Wno-openmp-mapping -Wuninitialized -Wno-vla
35 // Check
36 #ifdef CCODE
37 void foo(int arg) {
38 const int n = 0;
40 double marr[10][10][10];
42 #pragma omp target map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
44 #pragma omp target map(marr[:][0:][:])
46 #pragma omp target map(marr[:][1:][:]) // expected-error {{array section does not specify contiguous storage}}
48 #pragma omp target map(marr[:][n:][:])
51 #else
53 void xxx(int argc) {
54 int map; // expected-note {{initialize the variable 'map' to silence this warning}}
55 #pragma omp target map(tofrom: map) // expected-warning {{variable 'map' is uninitialized when used here}}
56 for (int i = 0; i < 10; ++i)
61 struct SREF {
62 int &a;
63 int b;
64 SREF(int &a) : a(a) {}
67 template <typename T, int I>
68 struct SA {
69 static int ss;
70 #pragma omp threadprivate(ss) // expected-note {{defined as threadprivate or thread local}}
71 float a;
72 int b[12];
73 float *c;
74 T d;
75 float e[I];
76 T *f;
77 int bf : 20;
78 void func(int arg) {
79 SREF sref(arg);
80 #pragma omp target
82 a = 0.0;
83 func(arg);
84 bf = 20;
86 #pragma omp target map(arg,a,d,sref.b)
88 #pragma omp target map(arg[2:2],a,d) // expected-error {{subscripted value is not an array or pointer}}
90 #pragma omp target map(arg,a*2) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error {{expected addressable lvalue in 'map' clause}}
92 #pragma omp target map(arg,(c+1)[2]) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
94 #pragma omp target map(arg,a[:2],d) // expected-error {{subscripted value is not an array or pointer}}
96 #pragma omp target map(arg,a,d[:2]) // expected-error {{subscripted value is not an array or pointer}}
99 #pragma omp target map(to:ss) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
102 #pragma omp target map(to:b,e)
104 #pragma omp target map(to:b,e) map(to:b) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
106 #pragma omp target map(to:b[:2],e)
108 #pragma omp target map(to:b,e[:])
110 #pragma omp target map(b[-1:]) // expected-error {{array section must be a subset of the original array}}
112 #pragma omp target map(b[:-1]) // expected-error {{section length is evaluated to a negative value -1}}
114 #pragma omp target map(b[true:true])
117 #pragma omp target map(: c,f) // lt60-error {{missing map type}} // ge60-error {{empty modifier-specification-list is not allowed}}
119 #pragma omp target map(always, tofrom: c,f)
121 #pragma omp target map(always, tofrom: c[1:2],f)
123 #pragma omp target map(always, tofrom: c,f[1:2])
125 #pragma omp target map(always, tofrom: c[:],f) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
127 #pragma omp target map(always, tofrom: c,f[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
129 #pragma omp target map(always) // expected-error {{use of undeclared identifier 'always'}}
131 #pragma omp target map(close, tofrom: c,f)
133 #pragma omp target map(close, tofrom: c[1:2],f)
135 #pragma omp target map(close, tofrom: c,f[1:2])
137 #pragma omp target map(close, tofrom: c[:],f) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
139 #pragma omp target map(close, tofrom: c,f[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
141 #pragma omp target map(close) // expected-error {{use of undeclared identifier 'close'}}
143 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
144 #pragma omp target map(present, tofrom: c,f)
146 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
147 #pragma omp target map(present, tofrom: c[1:2],f)
149 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
150 #pragma omp target map(present, tofrom: c,f[1:2])
152 // expected-error@+2 {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
153 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
154 #pragma omp target map(present, tofrom: c[:],f)
156 // expected-error@+2 {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
157 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
158 #pragma omp target map(present, tofrom: c,f[:])
160 // expected-error@+1 {{use of undeclared identifier 'present'}}
161 #pragma omp target map(present)
163 // ge52-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
164 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
165 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
166 #pragma omp target map(ompx_hold, tofrom: c,f)
168 // ge52-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
169 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
170 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
171 #pragma omp target map(ompx_hold, tofrom: c[1:2],f)
173 // ge52-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
174 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
175 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
176 #pragma omp target map(ompx_hold, tofrom: c,f[1:2])
178 // ge52-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
179 // expected-error@+3 {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
180 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
181 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
182 #pragma omp target map(ompx_hold, tofrom: c[:],f)
184 // ge52-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
185 // expected-error@+3 {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
186 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
187 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
188 #pragma omp target map(ompx_hold, tofrom: c,f[:])
190 // expected-error@+1 {{use of undeclared identifier 'ompx_hold'}}
191 #pragma omp target map(ompx_hold)
193 #pragma omp target map(close, close, tofrom: a) // expected-error {{same map type modifier has been specified more than once}}
195 #pragma omp target map(always, close, always, close, tofrom: a) // expected-error 2 {{same map type modifier has been specified more than once}}
197 // ge60-error@+3 {{same map type modifier has been specified more than once}}
198 // ge51-error@+2 {{same map type modifier has been specified more than once}}
199 // lt51-error@+1 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
200 #pragma omp target map(present, present, tofrom: a)
202 // ge52-error@+4 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
203 // ompx-error@+3 {{same map type modifier has been specified more than once}}
204 // ge51-omp-error@+2 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
205 // lt51-omp-error@+1 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
206 #pragma omp target map(ompx_hold, ompx_hold, tofrom: a)
208 // ge60-error@+9 {{same map type modifier has been specified more than once}}
209 // ge52-error@+8 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
210 // expected-error@+7 2 {{same map type modifier has been specified more than once}}
211 // ge51-error@+6 {{same map type modifier has been specified more than once}}
212 // lt51-ompx-error@+5 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
213 // lt51-omp-error@+4 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
214 // ompx-error@+3 {{same map type modifier has been specified more than once}}
215 // ge51-omp-error@+2 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
216 // lt51-omp-error@+1 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
217 #pragma omp target map(always, close, present, ompx_hold, always, close, present, ompx_hold, tofrom: a)
219 #pragma omp target map( , tofrom: a) // expected-error {{missing map type modifier}}
221 #pragma omp target map( , , tofrom: a) // expected-error {{missing map type modifier}} expected-error {{missing map type modifier}}
223 #pragma omp target map( , , : a) // expected-error {{missing map type modifier}} expected-error {{missing map type modifier}} lt60-error {{missing map type}}
225 // ge60-error@+4 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
226 // ge51-error@+3 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
227 // lt51-error@+2 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
228 // expected-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
229 #pragma omp target map( d, f, bf: a)
231 // ge60-error@+5 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator}}
232 // expected-error@+4 {{missing map type modifier}}
233 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
234 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
235 // lt60-error@+1 {{missing map type}}
236 #pragma omp target map( , f, : a)
238 #pragma omp target map(always close: a) // lt60-error {{missing map type}} ge52-error{{missing ',' after map type modifier}}
240 #pragma omp target map(always close bf: a) // ge52-error 2 {{missing ',' after map type modifier}} expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
242 // ge52-error@+4 {{missing ',' after map type modifier}}
243 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
244 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
245 // lt60-error@+1 {{missing map type}}
246 #pragma omp target map(always tofrom close: a)
248 // ge60-note@+4 {{map type 'tofrom' is previous specified here}}
249 // ge60-error@+3 {{map type is already specified}}
250 // ge51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
251 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
252 #pragma omp target map(tofrom from: a)
254 // ge60-note@+5 {{map type 'to' is previous specified here}}
255 // ge60-error@+4 {{map type is already specified}}
256 // ge52-error@+3 {{missing ',' after map type modifier}}
257 // ge51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
258 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
259 #pragma omp target map(to always from: a)
261 #pragma omp target map(close bf: a) // ge52-error {{missing ',' after map type modifier}} expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
263 #pragma omp target map(([b[I]][bf])f) // lt50-error {{expected ',' or ']' in lambda capture list}} lt50-error {{expected ')'}} lt50-note {{to match this '('}}
265 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
266 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
267 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
268 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
269 #pragma omp target map(iterator(it=0:10), tofrom:a)
271 // ompx-error@+8 {{redefinition of 'it'}}
272 // ompx-note@+7 {{previous definition is here}}
273 // omp-error@+6 {{redefinition of 'it'}}
274 // omp-note@+5 {{previous definition is here}}
275 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
276 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
277 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
278 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
279 #pragma omp target map(iterator(it=0:10, it=0:20), tofrom:a)
281 // ge60-error@+7 {{expected '(' after 'iterator'}}
282 // ge51-ompx-error@+6 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
283 // lt51-ompx-error@+5 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
284 // lt51-error@+4 {{expected '(' after 'iterator'}}
285 // ge51-error@+3 {{expected '(' after 'iterator'}}
286 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
287 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
288 #pragma omp target map(iterator, tofrom:a)
290 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
291 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
292 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
293 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
294 #pragma omp target map(iterator(), tofrom:a)
296 return;
300 struct SB {
301 unsigned A;
302 unsigned B;
303 float Arr[100];
304 float *Ptr;
305 float *foo() {
306 return &Arr[0];
310 struct SC {
311 unsigned A : 2;
312 unsigned B : 3;
313 unsigned C;
314 unsigned D;
315 float Arr[100];
316 SB S;
317 SB ArrS[100];
318 SB *PtrS;
319 SB *&RPtrS;
320 float *Ptr;
322 SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
325 union SD {
326 unsigned A;
327 float B;
330 void SAclient(int arg) {
331 SA<int,123> s;
332 s.func(arg); // expected-note {{in instantiation of member function}}
333 double marr[10][10][10];
334 double marr2[5][10][1];
335 double mvla[5][arg][10];
336 double ***mptr;
337 const int n = 0;
338 const int m = 1;
339 double mvla2[5][arg][m+n+10];
341 SB *p;
343 SD u;
344 SC r(p),t(p);
345 #pragma omp target map(r)
347 #pragma omp target map(marr[2] [0:2] [0:2]) // expected-error {{array section does not specify contiguous storage}}
349 #pragma omp target map(marr[:] [0:2] [0:2]) // expected-error {{array section does not specify contiguous storage}}
351 #pragma omp target map(marr[2][3] [0:2])
353 #pragma omp target map(marr[:][:][:])
355 #pragma omp target map(marr[:2][:][:])
357 #pragma omp target map(marr [arg:][:][:])
359 #pragma omp target map(marr [arg:])
361 #pragma omp target map(marr [arg:][:arg][:]) // correct if arg is the size of dimension 2
363 #pragma omp target map(marr[:arg][:])
365 #pragma omp target map(marr[:arg] [n:])
367 #pragma omp target map(marr[:][:arg] [n:]) // correct if arg is the size of dimension 2
369 #pragma omp target map(marr[:][:m] [n:]) // expected-error {{array section does not specify contiguous storage}}
371 #pragma omp target map(marr [n:m][:arg] [n:])
373 #pragma omp target map(marr[:2][:1][:]) // expected-error {{array section does not specify contiguous storage}}
375 #pragma omp target map(marr[:2] [1:][:]) // expected-error {{array section does not specify contiguous storage}}
377 #pragma omp target map(marr[:2][:][:1]) // expected-error {{array section does not specify contiguous storage}}
379 #pragma omp target map(marr[:2][:] [1:]) // expected-error {{array section does not specify contiguous storage}}
381 #pragma omp target map(marr[:1][:2][:])
383 #pragma omp target map(marr[:1][0][:])
385 #pragma omp target map(marr[:arg][:2][:]) // correct if arg is 1
387 #pragma omp target map(marr[:1] [3:1][:2])
389 #pragma omp target map(marr[:1] [3:arg][:2]) // correct if arg is 1
391 #pragma omp target map(marr[:1] [3:2][:2]) // expected-error {{array section does not specify contiguous storage}}
393 #pragma omp target map(marr[:2][:10][:])
395 #pragma omp target map(marr[:2][:][:5 + 5])
397 #pragma omp target map(marr[:2] [2 + 2 - 4:] [0:5 + 5])
400 #pragma omp target map(marr[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
402 #pragma omp target map(marr2[:1][:2][0])
405 #pragma omp target map(mvla[:1][:][0]) // correct if the size of dimension 2 is 1.
407 #pragma omp target map(mvla[:2][:arg][:]) // correct if arg is the size of dimension 2.
409 #pragma omp target map(mvla[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
411 #pragma omp target map(mvla[1] [2:arg][:])
413 #pragma omp target map(mvla[:1][:][:])
415 #pragma omp target map(mvla2[:1][:2][:11])
417 #pragma omp target map(mvla2[:1][:2][:10]) // expected-error {{array section does not specify contiguous storage}}
420 #pragma omp target map(mptr[:2] [2 + 2 - 4:1] [0:5 + 5]) // expected-error {{array section does not specify contiguous storage}}
422 #pragma omp target map(mptr[:1][:2 - 1] [2:4 - 3])
424 #pragma omp target map(mptr[:1][:arg] [2:4 - 3]) // correct if arg is 1.
426 #pragma omp target map(mptr[:1][:2 - 1] [0:2])
428 #pragma omp target map(mptr[:1][:2] [0:2]) // expected-error {{array section does not specify contiguous storage}}
430 #pragma omp target map(mptr[:1][:] [0:2]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
432 #pragma omp target map(mptr[:2][:1] [0:2]) // expected-error {{array section does not specify contiguous storage}}
435 #pragma omp target map(r.ArrS[0].B)
437 #pragma omp target map(r.ArrS[:1].B) // expected-error {{OpenMP array section is not allowed here}}
439 #pragma omp target map(r.ArrS[:arg].B) // expected-error {{OpenMP array section is not allowed here}}
441 #pragma omp target map(r.ArrS[0].Arr [1:23])
443 #pragma omp target map(r.ArrS[0].Arr [1:arg])
445 #pragma omp target map(r.ArrS[0].Arr [arg:23])
447 #pragma omp target map(r.ArrS[0].Error) // expected-error {{no member named 'Error' in 'SB'}}
449 #pragma omp target map(r.ArrS[0].A, r.ArrS[1].A) // lt50-error {{multiple array elements associated with the same variable are not allowed in map clauses of the same construct}} lt50-note {{used here}}
451 #pragma omp target map(r.ArrS[0].A, t.ArrS[1].A)
453 #pragma omp target map(r.PtrS[0], r.PtrS->B) // lt50-error {{same pointer dereferenced in multiple different ways in map clause expressions}} lt50-note {{used here}}
455 #pragma omp target map(r.PtrS, r.PtrS->B) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}}
457 #pragma omp target map(r.PtrS->A, r.PtrS->B)
459 #pragma omp target map(r.RPtrS[0], r.RPtrS->B) // lt50-error {{same pointer dereferenced in multiple different ways in map clause expressions}} lt50-note {{used here}}
461 #pragma omp target map(r.RPtrS, r.RPtrS->B) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}}
463 #pragma omp target map(r.RPtrS->A, r.RPtrS->B)
465 #pragma omp target map(r.S.Arr[:12])
467 #pragma omp target map(r.S.foo() [:12]) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error {{expected addressable lvalue in 'map' clause}}
469 #pragma omp target map(r.C, r.D)
471 #pragma omp target map(r.C, r.C) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
473 #pragma omp target map(r.C) map(r.C) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
475 #pragma omp target 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.
477 #pragma omp target map(r, r.S) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
479 #pragma omp target map(r.C, t.C)
481 #pragma omp target map(r.A) // expected-error {{bit fields cannot be used to specify storage in a 'map' clause}}
483 #pragma omp target map(r.Arr)
485 #pragma omp target map(r.Arr [3:5])
487 #pragma omp target map(r.Ptr [3:5])
489 #pragma omp target map(r.ArrS [3:5].A) // expected-error {{OpenMP array section is not allowed here}}
491 #pragma omp target map(r.ArrS [3:5].Arr [6:7]) // expected-error {{OpenMP array section is not allowed here}}
493 #pragma omp target map(r.ArrS[3].Arr [6:7])
495 #pragma omp target map(r.S.Arr [4:5])
497 #pragma omp target map(r.S.Ptr [4:5])
499 #pragma omp target map(r.S.Ptr[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
501 #pragma omp target map((p + 1)->A) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
503 #pragma omp target map(u.B) // expected-error {{mapping of union members is not allowed}}
505 #pragma omp target
507 u.B = 0;
508 r.S.foo();
511 #pragma omp target data map(to \
512 : r.C) // lt50-note {{used here}}
514 #pragma omp target map(r.D) // lt50-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}}
518 #pragma omp target data map(to \
519 : t.Ptr) // lt50-note {{used here}}
521 #pragma omp target map(t.Ptr[:23]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}}
525 #pragma omp target data map(to \
526 : t.C, t.D)
528 #pragma omp target data map(to \
529 : t.C)
531 #pragma omp target map(t.D)
535 #pragma omp target data map(marr[:][:][:])
537 #pragma omp target data map(marr)
541 #pragma omp target data map(to \
542 : t)
544 #pragma omp target data map(to \
545 : t.C)
547 #pragma omp target map(t.D)
552 void foo() {
555 bool foobool(int argc) {
556 return argc;
559 struct S1; // expected-note 2 {{declared here}} // expected-note 3 {{forward declaration of 'S1'}}
560 extern S1 a;
561 class S2 {
562 mutable int a;
563 public:
564 S2():a(0) { }
565 S2(S2 &s2):a(s2.a) { }
566 static float S2s;
567 static const float S2sc;
569 const float S2::S2sc = 0;
570 const S2 b;
571 const S2 ba[5];
572 class S3 {
573 int a;
574 public:
575 S3():a(0) { }
576 S3(S3 &s3):a(s3.a) { }
578 const S3 c;
579 const S3 ca[5];
580 extern const int f;
581 class S4 {
582 int a;
583 S4();
584 S4(const S4 &s4);
585 public:
586 S4(int v):a(v) { }
588 class S5 {
589 int a;
590 S5():a(0) {}
591 S5(const S5 &s5):a(s5.a) { }
592 public:
593 S5(int v):a(v) { }
596 template <class T>
597 struct S6;
599 template<>
600 struct S6<int>
602 virtual void foo();
605 S3 h;
606 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
608 typedef int from;
610 struct dim {
611 double x, y;
614 template<typename T>
615 class Array1D
617 public:
618 unsigned n1;
619 unsigned size;
620 T * dptr;
622 inline T& operator() (unsigned i1) { return dptr[i1]; }
624 Array1D() {n1=0;size=0;dptr=nullptr;}
627 template <typename T, int I> // expected-note {{declared here}}
628 T tmain(T argc) {
629 const T d = 5;
630 const T da[5] = { 0 };
631 S4 e(4);
632 S5 g(5);
633 T i, t[20];
634 T &j = i;
635 T *k = &j;
636 T x;
637 T y;
638 T to, tofrom, always, close, present;
639 const T (&l)[5] = da;
640 #pragma omp target map // expected-error {{expected '(' after 'map'}}
642 #pragma omp target map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
644 #pragma omp target map() // expected-error {{expected expression}}
646 #pragma omp target map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
648 #pragma omp target map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
650 #pragma omp target map(to:) // expected-error {{expected expression}}
652 #pragma omp target map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
654 #pragma omp target map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
656 #pragma omp target map(x)
657 foo();
658 #pragma omp target map(tofrom: t[:I])
659 foo();
660 #pragma omp target 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}}
661 foo();
662 #pragma omp target map(T) // expected-error {{'T' does not refer to a value}}
663 foo();
664 #pragma omp target map(I) // lt50-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error 2 {{expected addressable lvalue in 'map' clause}}
665 foo();
666 #pragma omp target map(S2::S2s)
667 foo();
668 #pragma omp target map(S2::S2sc)
669 foo();
670 #pragma omp target map(x)
671 foo();
672 #pragma omp target map(to: x)
673 foo();
674 #pragma omp target map(to: to)
675 foo();
676 #pragma omp target map(to)
677 foo();
678 #pragma omp target map(to, x)
679 foo();
680 #pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
681 #pragma omp target data map(tofrom: argc > 0 ? x : y) // lt50-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error 2 {{expected addressable lvalue in 'map' clause}}
682 #pragma omp target data map(argc)
683 #pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
684 #pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} warn-warning 2 {{type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning 2 {{type 'const S3' is not trivially copyable and not guaranteed to be mapped correctly}}
685 #pragma omp target data map(ba) // warn-warning 2 {{type 'const S2 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
686 #pragma omp target data map(ca) // warn-warning 2 {{type 'const S3 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
687 #pragma omp target data map(da)
688 #pragma omp target data map(S2::S2s)
689 #pragma omp target data map(S2::S2sc)
690 #pragma omp target data map(e, g) // warn-warning 2 {{type 'S4' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning 2 {{type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
691 #pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
692 #pragma omp target data map(k) map(k) // lt50-error 2 {{variable already marked as mapped in current construct}} lt50-note 2 {{used here}}
693 #pragma omp target map(k), map(k[:5]) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}} lt50-note 2 {{used here}}
694 foo();
695 #pragma omp target data map(da)
696 #pragma omp target map(da[:4])
697 foo();
698 #pragma omp target data map(k, j, l) // lt50-note 2 {{used here}}
699 #pragma omp target data map(k[:4]) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}}
700 #pragma omp target data map(j)
701 #pragma omp target map(l) map(l[:5]) // lt50-error 2 {{variable already marked as mapped in current construct}} lt50-note 2 {{used here}}
702 foo();
703 #pragma omp target data map(k[:4], j, l[:5]) // lt50-note 2 {{used here}}
704 #pragma omp target data map(k) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}}
705 #pragma omp target data map(j)
706 #pragma omp target map(l)
707 foo();
709 #pragma omp target data map(always, tofrom: x)
710 #pragma omp target data map(always: x) // lt60-error {{missing map type}}
711 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
712 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
713 // lt60-error@+1 {{missing map type}}
714 #pragma omp target data map(tofrom, always: x)
715 #pragma omp target data map(always, tofrom: always, tofrom, x)
716 #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
717 foo();
719 #pragma omp target data map(close, tofrom: x)
720 #pragma omp target data map(close: x) // lt60-error {{missing map type}}
721 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
722 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
723 // lt60-error@+1 {{missing map type}}
724 #pragma omp target data map(tofrom, close: x)
725 #pragma omp target data map(close, tofrom: close, tofrom, x)
726 foo();
728 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
729 #pragma omp target data map(present, tofrom: x)
730 // ge51-error@+2 {{missing map type}}
731 // lt51-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
732 #pragma omp target data map(present: x)
733 // ge51-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
734 // lt51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
735 // ge51-error@+2 {{missing map type}}
736 // lt51-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
737 #pragma omp target data map(tofrom, present: x)
738 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
739 #pragma omp target data map(present, tofrom: present, tofrom, x)
740 foo();
742 T marr[10][10], iarr[5];
743 #pragma omp target data map(marr[10][0:2:2]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
745 #pragma omp target data map(iarr[:2:d]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
747 return 0;
750 struct SA1{
751 int a;
752 struct SA1 *p;
753 int b[10];
755 struct SB1{
756 int a;
757 struct SA1 s;
758 struct SA1 sa[10];
759 struct SA1 *sp[10];
760 struct SA1 *p;
762 struct SC1{
763 int a;
764 struct SB1 s;
765 struct SB1 *p;
766 int b[10];
769 class S8 {
770 public:
771 virtual void foo() = 0;
772 } *s8;
774 class S9 {
775 public:
776 virtual void foo() {}
777 } s9;
780 int main(int argc, char **argv) {
781 const int d = 5;
782 const int da[5] = { 0 };
783 S4 e(4);
784 S5 g(5);
785 int i;
786 int &j = i;
787 int *k = &j;
788 S6<int> m;
789 int x;
790 int y;
791 int to, tofrom, always, close, present;
792 const int (&l)[5] = da;
793 SC1 s;
794 SC1 *p;
795 int Arr[10];
796 #pragma omp target data map // expected-error {{expected '(' after 'map'}} lt50-error {{expected at least one 'map' or 'use_device_ptr' clause for '#pragma omp target data'}} ge50-error {{expected at least one 'map', 'use_device_ptr', or 'use_device_addr' clause for '#pragma omp target data'}}
797 #pragma omp target data map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
798 #pragma omp target data map() // expected-error {{expected expression}}
799 #pragma omp target data map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
800 #pragma omp target data map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
801 #pragma omp target data map(to:) // expected-error {{expected expression}}
802 #pragma omp target data map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
803 #pragma omp target data map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
804 #pragma omp target map(x)
805 foo();
806 #pragma omp target map(to: x)
807 foo();
808 #pragma omp target map(to: to)
809 foo();
810 #pragma omp target map(to)
811 foo();
812 #pragma omp target map(to, x)
813 foo();
814 #pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
815 #pragma omp target data map(tofrom: argc > 0 ? argv[1] : argv[2]) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error {{expected addressable lvalue in 'map' clause}}
816 #pragma omp target data map(argc)
817 #pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
818 #pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} warn-warning {{type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning {{type 'const S3' is not trivially copyable and not guaranteed to be mapped correctly}}
819 #pragma omp target data map(argv[1])
820 #pragma omp target data map(ba) // warn-warning {{type 'const S2 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
821 #pragma omp target data map(ca) // warn-warning {{type 'const S3 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
822 #pragma omp target data map(da)
823 #pragma omp target data map(S2::S2s)
824 #pragma omp target data map(S2::S2sc)
825 #pragma omp target data map(e, g) // warn-warning {{type 'S4' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning {{type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
826 #pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
827 #pragma omp target data map(k), map(k) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
828 #pragma omp target map(k), map(k[:5]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}}
829 foo();
830 #pragma omp target data map(da)
831 #pragma omp target map(da[:4])
832 foo();
833 #pragma omp target data map(k, j, l) // lt50-note {{used here}}
834 #pragma omp target data map(k[:4]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}}
835 #pragma omp target data map(j)
836 #pragma omp target map(l) map(l[:5]) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
837 foo();
838 #pragma omp target data map(k[:4], j, l[:5]) // lt50-note {{used here}}
839 #pragma omp target data map(k) // lt50-error {{pointer cannot be mapped along with a section derived from itself}}
840 #pragma omp target data map(j)
841 #pragma omp target map(l)
842 foo();
844 #pragma omp target data map(always, tofrom: x)
845 #pragma omp target data map(always: x) // lt60-error {{missing map type}}
846 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
847 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
848 // lt60-error@+1 {{missing map type}}
849 #pragma omp target data map(tofrom, always: x)
850 #pragma omp target data map(always, tofrom: always, tofrom, x)
851 #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
852 foo();
853 #pragma omp target data map(close, tofrom: x)
854 #pragma omp target data map(close: x) // lt60-error {{missing map type}}
855 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
856 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
857 // lt60-error@+1 {{missing map type}}
858 #pragma omp target data map(tofrom, close: x)
859 foo();
860 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
861 #pragma omp target data map(present, tofrom: x)
862 // ge51-error@+2 {{missing map type}}
863 // lt51-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
864 #pragma omp target data map(present: x)
865 // ge51-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
866 // lt51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
867 // ge51-error@+2 {{missing map type}}
868 // lt51-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
869 #pragma omp target data map(tofrom, present: x)
870 foo();
871 #pragma omp target private(j) map(j) // expected-error {{private variable cannot be in a map clause in '#pragma omp target' directive}} expected-note {{defined as private}}
873 #pragma omp target firstprivate(j) map(j) // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target' directive}} expected-note {{defined as firstprivate}}
875 #pragma omp target map(m) // warn-warning {{type 'S6<int>' is not trivially copyable and not guaranteed to be mapped correctly}}
877 #pragma omp target
878 { s.a++; }
879 // lt50-note@+1 {{used here}}
880 #pragma omp target map(s.s.s)
881 // lt50-error@+1 {{variable already marked as mapped in current construct}}
882 { s.a++; }
883 // lt50-note@+1 {{used here}}
884 #pragma omp target map(s.s.s.a)
885 // lt50-error@+1 {{variable already marked as mapped in current construct}}
886 { s.a++; }
887 // lt50-note@+1 {{used here}}
888 #pragma omp target map(s.b[:5])
889 // lt50-error@+1 {{variable already marked as mapped in current construct}}
890 { s.a++; }
891 #pragma omp target map(s.p[:5])
892 { s.a++; }
893 // lt50-note@+1 {{used here}}
894 #pragma omp target map(s.s.sa[3].a)
895 // lt50-error@+1 {{variable already marked as mapped in current construct}}
896 { s.a++; }
897 // lt50-note@+1 {{used here}}
898 #pragma omp target map(s.s.sp[3]->a)
899 // lt50-error@+1 {{variable already marked as mapped in current construct}}
900 { s.a++; }
901 // lt50-note@+1 {{used here}}
902 #pragma omp target map(s.p->a)
903 // lt50-error@+1 {{variable already marked as mapped in current construct}}
904 { s.a++; }
905 // lt50-note@+1 {{used here}}
906 #pragma omp target map(s.s.p->a)
907 // lt50-error@+1 {{variable already marked as mapped in current construct}}
908 { s.a++; }
909 // lt50-note@+1 {{used here}}
910 #pragma omp target map(s.s.s.b[:2])
911 // lt50-error@+1 {{variable already marked as mapped in current construct}}
912 { s.a++; }
913 // lt50-note@+1 {{used here}}
914 #pragma omp target map(s.s.p->b[:2])
915 // lt50-error@+1 {{variable already marked as mapped in current construct}}
916 { s.a++; }
917 // lt50-note@+1 {{used here}}
918 #pragma omp target map(s.p->p->p->a)
919 // lt50-error@+1 {{variable already marked as mapped in current construct}}
920 { s.a++; }
921 #pragma omp target map(s.s.s.b[:2])
922 { s.s.s.b[0]++; }
923 #pragma omp target map(s8[0:1], s9) // warn-warning {{type 'class S8' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning {{type 'class S9' is not trivially copyable and not guaranteed to be mapped correctly}}
926 int **BB, *offset, *a;
928 #pragma omp target map(**(BB+*offset)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
930 #pragma omp target map(**(BB+y)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
932 #pragma omp target map(*(a+*offset)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
934 #pragma omp target map(**(*offset+BB)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
936 #pragma omp target map(**(y+BB)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
938 #pragma omp target map(*(*offset+a)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
940 #pragma omp target map(**(*offset+BB+*a)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
942 #pragma omp target map(**(*(*(&offset))+BB+*a)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
944 #pragma omp target map(*(a+(a))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}}
946 #pragma omp target map(*(1+*a+*a)) // expected-error {{indirection requires pointer operand ('int' invalid)}}
949 #pragma omp target map(delete: a) // expected-error {{map type 'delete' is not allowed for '#pragma omp target'}}
951 #pragma omp target map(release: a) // expected-error {{map type 'release' is not allowed for '#pragma omp target'}}
954 int marr[10][10], iarr[5];
956 #pragma omp target map(marr[10][0:2:2]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
958 #pragma omp target map(iarr[:2:d]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
961 #pragma omp target data map(Arr[0:4]) // lt50-note {{used here}}
963 #pragma omp target
964 Arr[0] = 2; // lt50-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}}
967 Array1D<dim> pos;
969 #pragma omp target enter data map(to:pos)
970 #pragma omp target enter data map(to:pos.dptr[0:pos.size])
971 #pragma omp target teams distribute parallel for
972 for(int i=0; i<100; i++) {
973 pos(i).x = i;
974 pos(i).y = i+1;
977 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
978 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
979 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
980 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
981 #pragma omp target map(iterator(it=0:10), tofrom:a[it])
984 // ompx-error@+8 {{use of undeclared identifier 'itt'; did you mean 'it'?}}
985 // ompx-note@+7 {{'it' declared here}}
986 // omp-error@+6 {{use of undeclared identifier 'itt'; did you mean 'it'?}}
987 // omp-note@+5 {{'it' declared here}}
988 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
989 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
990 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
991 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
992 #pragma omp target map(iterator(it=0:10), tofrom:a[itt])
995 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}}
997 #endif