1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4 %s -Wno-openmp-mapping -Wuninitialized
2 // RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp5 %s -Wno-openmp-mapping -Wuninitialized
4 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4 %s -Wno-openmp-mapping -Wuninitialized
5 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp5 %s -Wno-openmp-mapping -Wuninitialized
9 S() : a(0) {} // expected-note {{implicitly declared private here}}
13 S(const S
&s
) : a(s
.a
) {}
17 // expected-note@+1 {{defined as threadprivate or thread local}}
18 #pragma omp threadprivate(sii)
21 int test_iteration_spaces() {
23 float a
[N
], b
[N
], c
[N
];
27 #pragma omp target teams distribute
28 for (int i
= 0; i
< 10; i
+= 1) {
31 #pragma omp target teams distribute
32 for (char i
= 0; i
< 10; i
++) {
35 #pragma omp target teams distribute
36 for (char i
= 0; i
< 10; i
+= '\1') {
39 #pragma omp target teams distribute
40 for (long long i
= 0; i
< 10; i
++) {
43 #pragma omp target teams distribute
44 // expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'double'}}
45 for (long long i
= 0; i
< 10; i
+= 1.5) {
48 #pragma omp target teams distribute
49 for (long long i
= 0; i
< 'z'; i
+= 1u) {
52 #pragma omp target teams distribute
53 // expected-error@+1 {{variable must be of integer or random access iterator type}}
54 for (float fi
= 0; fi
< 10.0; fi
++) {
55 c
[(int)fi
] = a
[(int)fi
] + b
[(int)fi
];
57 #pragma omp target teams distribute
58 // expected-error@+1 {{variable must be of integer or random access iterator type}}
59 for (double fi
= 0; fi
< 10.0; fi
++) {
60 c
[(int)fi
] = a
[(int)fi
] + b
[(int)fi
];
62 #pragma omp target teams distribute
63 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
64 for (int &ref
= ii
; ref
< 10; ref
++) {
66 #pragma omp target teams distribute
67 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
68 for (int i
; i
< 10; i
++)
71 #pragma omp target teams distribute
72 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
73 for (int i
= 0, j
= 0; i
< 10; ++i
)
76 #pragma omp target teams distribute
77 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
81 #pragma omp target teams distribute
82 // expected-warning@+2 {{expression result unused}}
83 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
84 for (ii
+ 1; ii
< 10; ++ii
)
87 #pragma omp target teams distribute
88 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
89 for (c
[ii
] = 0; ii
< 10; ++ii
)
92 #pragma omp target teams distribute
93 // Ok to skip parenthesises.
94 for (((ii
)) = 0; ii
< 10; ++ii
)
97 #pragma omp target teams distribute
98 // omp4-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} omp5-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
99 for (int i
= 0; i
; i
++)
102 #pragma omp target teams distribute
103 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} omp5-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
104 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
105 for (int i
= 0; jj
< kk
; ii
++)
108 #pragma omp target teams distribute
109 // omp4-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} omp5-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
110 for (int i
= 0; !!i
; i
++)
113 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
114 #pragma omp target teams distribute
115 for (int i
= 0; i
!= 1; i
++)
118 #pragma omp target teams distribute
119 // omp4-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} omp5-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
120 for (int i
= 0;; i
++)
124 #pragma omp target teams distribute
125 for (int i
= 11; i
> 10; i
--)
129 #pragma omp target teams distribute
130 for (int i
= 0; i
< 10; ++i
)
134 #pragma omp target teams distribute
135 for (ii
= 0; ii
< 10; ++ii
)
138 #pragma omp target teams distribute
139 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
140 for (ii
= 0; ii
< 10; ++jj
)
143 #pragma omp target teams distribute
144 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
145 for (ii
= 0; ii
< 10; ++++ii
)
148 // Ok but undefined behavior (in general, cannot check that incr
149 // is really loop-invariant).
150 #pragma omp target teams distribute
151 for (ii
= 0; ii
< 10; ii
= ii
+ ii
)
154 #pragma omp target teams distribute
155 // expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'float'}}
156 for (ii
= 0; ii
< 10; ii
= ii
+ 1.0f
)
159 // Ok - step was converted to integer type.
160 #pragma omp target teams distribute
161 for (ii
= 0; ii
< 10; ii
= ii
+ (int)1.1f
)
164 #pragma omp target teams distribute
165 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
166 for (ii
= 0; ii
< 10; jj
= ii
+ 2)
169 #pragma omp target teams distribute
170 // expected-warning@+2 {{relational comparison result unused}}
171 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
172 for (ii
= 0; ii
<10; jj
> kk
+ 2)
175 #pragma omp target teams distribute
176 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
177 for (ii
= 0; ii
< 10;)
180 #pragma omp target teams distribute
181 // expected-warning@+2 {{expression result unused}}
182 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
183 for (ii
= 0; ii
< 10; !ii
)
186 #pragma omp target teams distribute
187 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
188 for (ii
= 0; ii
< 10; ii
? ++ii
: ++jj
)
191 #pragma omp target teams distribute
192 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
193 for (ii
= 0; ii
< 10; ii
= ii
< 10)
196 #pragma omp target teams distribute
197 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
198 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
199 for (ii
= 0; ii
< 10; ii
= ii
+ 0)
202 #pragma omp target teams distribute
203 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
204 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
205 for (ii
= 0; ii
< 10; ii
= ii
+ (int)(0.8 - 0.45))
208 #pragma omp target teams distribute
209 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
210 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
211 for (ii
= 0; (ii
) < 10; ii
-= 25)
214 #pragma omp target teams distribute
215 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
216 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
217 for (ii
= 0; (ii
< 10); ii
-= 0)
220 #pragma omp target teams distribute
221 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
222 // expected-error@+1 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
223 for (ii
= 0; ii
> 10; (ii
+= 0))
226 #pragma omp target teams distribute
227 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
228 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
229 for (ii
= 0; ii
< 10; (ii
) = (1 - 1) + (ii
))
232 #pragma omp target teams distribute
233 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
234 // expected-error@+1 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
235 for ((ii
= 0); ii
> 10; (ii
-= 0))
238 #pragma omp target teams distribute
239 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
240 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
241 for (ii
= 0; (ii
< 10); (ii
-= 0))
244 #pragma omp target teams distribute firstprivate(ii) // expected-note {{defined as firstprivate}}
245 // expected-error@+1 {{loop iteration variable in the associated loop of 'omp target teams distribute' directive may not be firstprivate, predetermined as private}}
246 for (ii
= 0; ii
< 10; ii
++)
249 #pragma omp target teams distribute private(ii)
251 for (ii
= 0; ii
< 10; ii
++)
254 #pragma omp target teams distribute lastprivate(ii)
256 for (ii
= 0; ii
< 10; ii
++)
259 #pragma omp target teams distribute
260 // expected-error@+1 {{loop iteration variable in the associated loop of 'omp target teams distribute' directive may not be threadprivate or thread local, predetermined as private}}
261 for (sii
= 0; sii
< 10; sii
++)
265 #pragma omp target teams distribute collapse(2)
266 for (ii
= 0; ii
< 10; ii
+= 1)
267 for (globalii
= 0; globalii
< 10; globalii
+= 1)
268 c
[globalii
] += a
[globalii
] + ii
;
271 #pragma omp target teams distribute
272 // omp4-error@+1 {{statement after '#pragma omp target teams distribute' must be a for loop}}
273 for (auto &item
: a
) {
277 #pragma omp target teams distribute
278 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
279 // expected-error@+1 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
280 for (unsigned i
= 9; i
< 10; i
--) {
284 int(*lb
)[4] = nullptr;
285 #pragma omp target teams distribute
286 for (int(*p
)[4] = lb
; p
< lb
+ 8; ++p
) {
289 #pragma omp target teams distribute
290 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
291 for (int a
{0}; a
< 10; ++a
) {
297 // Iterators allowed in openmp for-loops.
299 struct random_access_iterator_tag
{};
300 template <class Iter
>
301 struct iterator_traits
{
302 typedef typename
Iter::difference_type difference_type
;
303 typedef typename
Iter::iterator_category iterator_category
;
305 template <class Iter
>
306 typename iterator_traits
<Iter
>::difference_type
307 distance(Iter first
, Iter last
) { return first
- last
; }
312 Iter0(const Iter0
&) {}
313 Iter0
operator++() { return *this; }
314 Iter0
operator--() { return *this; }
315 bool operator<(Iter0 a
) { return true; }
317 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'Iter0' for 1st argument}}
318 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}}
319 int operator-(Iter0 a
, Iter0 b
) { return 0; }
322 Iter1(float f
= 0.0f
, double d
= 0.0) {}
323 Iter1(const Iter1
&) {}
324 Iter1
operator++() { return *this; }
325 Iter1
operator--() { return *this; }
326 bool operator<(Iter1 a
) { return true; }
327 bool operator>=(Iter1 a
) { return false; }
332 GoodIter(const GoodIter
&) {}
333 GoodIter(int fst
, int snd
) {}
334 GoodIter
&operator=(const GoodIter
&that
) { return *this; }
335 GoodIter
&operator=(const Iter0
&that
) { return *this; }
336 GoodIter
&operator+=(int x
) { return *this; }
337 explicit GoodIter(void *) {}
338 GoodIter
operator++() { return *this; }
339 GoodIter
operator--() { return *this; }
340 bool operator!() { return true; }
341 bool operator<(GoodIter a
) { return true; }
342 bool operator<=(GoodIter a
) { return true; }
343 bool operator>=(GoodIter a
) { return false; }
344 typedef int difference_type
;
345 typedef std::random_access_iterator_tag iterator_category
;
347 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'GoodIter' for 2nd argument}}
348 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
349 int operator-(GoodIter a
, GoodIter b
) { return 0; }
350 // expected-note@+1 3 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}}
351 GoodIter
operator-(GoodIter a
) { return a
; }
352 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'int' for 2nd argument}}
353 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
354 GoodIter
operator-(GoodIter a
, int v
) { return GoodIter(); }
355 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'GoodIter' for 1st argument}}
356 GoodIter
operator+(GoodIter a
, int v
) { return GoodIter(); }
357 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'int' for 1st argument}}
358 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}}
359 GoodIter
operator-(int v
, GoodIter a
) { return GoodIter(); }
360 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'int' for 1st argument}}
361 GoodIter
operator+(int v
, GoodIter a
) { return GoodIter(); }
363 int test_with_random_access_iterator() {
366 #pragma omp target teams distribute
367 for (GoodIter I
= begin
; I
< end
; ++I
)
369 #pragma omp target teams distribute
370 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
371 for (GoodIter
&I
= begin
; I
< end
; ++I
)
373 #pragma omp target teams distribute
374 for (GoodIter I
= begin
; I
>= end
; --I
)
376 #pragma omp target teams distribute
377 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
378 for (GoodIter
I(begin
); I
< end
; ++I
)
380 #pragma omp target teams distribute
381 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
382 for (GoodIter
I(nullptr); I
< end
; ++I
)
384 #pragma omp target teams distribute
385 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
386 for (GoodIter
I(0); I
< end
; ++I
)
388 #pragma omp target teams distribute
389 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
390 for (GoodIter
I(1, 2); I
< end
; ++I
)
392 #pragma omp target teams distribute
393 for (begin
= GoodIter(0); begin
< end
; ++begin
)
395 #pragma omp target teams distribute
396 // expected-error@+2 {{invalid operands to binary expression ('GoodIter' and 'const Iter0')}}
397 // expected-error@+1 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
398 for (begin
= begin0
; begin
< end
; ++begin
)
400 #pragma omp target teams distribute
401 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
402 for (++begin
; begin
< end
; ++begin
)
404 #pragma omp target teams distribute
405 for (begin
= end
; begin
< end
; ++begin
)
407 #pragma omp target teams distribute
408 // omp4-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}} omp5-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'I'}}
409 for (GoodIter I
= begin
; I
- I
; ++I
)
411 #pragma omp target teams distribute
412 // omp4-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}} omp5-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'I'}}
413 for (GoodIter I
= begin
; begin
< end
; ++I
)
415 #pragma omp target teams distribute
416 // omp4-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}} omp5-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'I'}}
417 for (GoodIter I
= begin
; !I
; ++I
)
419 #pragma omp target teams distribute
420 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
421 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
422 for (GoodIter I
= begin
; I
>= end
; I
= I
+ 1)
424 #pragma omp target teams distribute
425 for (GoodIter I
= begin
; I
>= end
; I
= I
- 1)
427 #pragma omp target teams distribute
428 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
429 for (GoodIter I
= begin
; I
>= end
; I
= -I
)
431 #pragma omp target teams distribute
432 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
433 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
434 for (GoodIter I
= begin
; I
>= end
; I
= 2 + I
)
436 #pragma omp target teams distribute
437 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
438 for (GoodIter I
= begin
; I
>= end
; I
= 2 - I
)
440 #pragma omp target teams distribute
441 // expected-error@+1 {{invalid operands to binary expression ('Iter0' and 'int')}}
442 for (Iter0 I
= begin0
; I
< end0
; ++I
)
444 #pragma omp target teams distribute
445 // Initializer is constructor without params.
446 // expected-error@+2 {{invalid operands to binary expression ('Iter0' and 'int')}}
447 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
448 for (Iter0 I
; I
< end0
; ++I
)
451 #pragma omp target teams distribute
452 // expected-error@+2 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
453 // expected-error@+1 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
454 for (Iter1 I
= begin1
; I
< end1
; ++I
)
456 #pragma omp target teams distribute
457 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
458 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
459 for (Iter1 I
= begin1
; I
>= end1
; ++I
)
461 #pragma omp target teams distribute
462 // expected-error@+4 {{invalid operands to binary expression ('Iter1' and 'float')}}
463 // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
464 // Initializer is constructor with all default params.
465 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
466 for (Iter1 I
; I
< end1
; ++I
) {
471 template <typename IT
, int ST
>
474 int dotest_lt(IT begin
, IT end
) {
475 #pragma omp target teams distribute
476 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
477 // expected-error@+1 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
478 for (IT I
= begin
; I
< end
; I
= I
+ ST
) {
481 #pragma omp target teams distribute
482 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
483 // expected-error@+1 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
484 for (IT I
= begin
; I
<= end
; I
+= ST
) {
487 #pragma omp target teams distribute
488 for (IT I
= begin
; I
< end
; ++I
) {
497 template <typename IT
, int ST
= 0>
498 int dotest_gt(IT begin
, IT end
) {
499 #pragma omp target teams distribute
500 // expected-note@+2 2 {{loop step is expected to be negative due to this condition}}
501 // expected-error@+1 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
502 for (IT I
= begin
; I
>= end
; I
= I
+ ST
) {
505 #pragma omp target teams distribute
506 // expected-note@+2 2 {{loop step is expected to be negative due to this condition}}
507 // expected-error@+1 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
508 for (IT I
= begin
; I
>= end
; I
+= ST
) {
512 #pragma omp target teams distribute
513 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
514 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
515 for (IT I
= begin
; I
>= end
; ++I
) {
519 #pragma omp target teams distribute
520 for (IT I
= begin
; I
< end
; I
+= TC
<int, ST
>::step()) {
525 void test_with_template() {
527 TC
<GoodIter
, 100> t1
;
528 TC
<GoodIter
, -100> t2
;
529 t1
.dotest_lt(begin
, end
);
530 t2
.dotest_lt(begin
, end
); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
531 dotest_gt(begin
, end
); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
532 dotest_gt
<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
535 void test_loop_break() {
537 float a
[N
], b
[N
], c
[N
];
538 #pragma omp target teams distribute
539 for (int i
= 0; i
< 10; i
++) {
541 for (int j
= 0; j
< 10; ++j
) {
543 break; // OK in nested loop
553 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
556 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
559 #pragma omp target teams distribute
560 for (int i
= 0; i
< 10; i
++) {
561 for (int j
= 0; j
< 10; j
++) {
572 void test_loop_eh() {
574 float a
[N
], b
[N
], c
[N
];
575 #pragma omp target teams distribute
576 for (int i
= 0; i
< 10; i
++) {
579 for (int j
= 0; j
< 10; ++j
) {
587 return; // expected-error {{cannot return from OpenMP region}}
596 for (int j
= 0; j
< 10; j
++) {
604 #pragma omp target teams distribute
605 for (int i
= 0; i
< 10; ++i
) {
607 void g() { throw 0; }
612 void test_loop_firstprivate_lastprivate() {
614 // expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
615 #pragma omp target teams distribute lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
616 for (int i
= 0; i
< 16; ++i
)
620 void test_ordered() {
621 #pragma omp target teams distribute ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp target teams distribute'}}
622 for (int i
= 0; i
< 16; ++i
)