1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s
3 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s
7 S() : a(0) {} // expected-note {{implicitly declared private here}}
11 S(const S &s) : a(s.a) {}
15 // expected-note@+1 {{defined as threadprivate or thread local}}
16 #pragma omp threadprivate(sii)
19 int test_iteration_spaces() {
21 float a[N], b[N], c[N];
26 #pragma omp teams distribute parallel for
27 for (int i = 0; i < 10; i += 1) {
31 #pragma omp teams distribute parallel for
32 for (char i = 0; i < 10; i++) {
36 #pragma omp teams distribute parallel for
37 for (char i = 0; i < 10; i += '\1') {
41 #pragma omp teams distribute parallel for
42 for (long long i = 0; i < 10; i++) {
46 #pragma omp teams distribute parallel for
47 // expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'double'}}
48 for (long long i = 0; i < 10; i += 1.5) {
52 #pragma omp teams distribute parallel for
53 for (long long i = 0; i < 'z'; i += 1u) {
57 #pragma omp teams distribute parallel for
58 // expected-error@+1 {{variable must be of integer or random access iterator type}}
59 for (float fi = 0; fi < 10.0; fi++) {
60 c[(int)fi] = a[(int)fi] + b[(int)fi];
63 #pragma omp teams distribute parallel for
64 // expected-error@+1 {{variable must be of integer or random access iterator type}}
65 for (double fi = 0; fi < 10.0; fi++) {
66 c[(int)fi] = a[(int)fi] + b[(int)fi];
69 #pragma omp teams distribute parallel for
70 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
71 for (int &ref = ii; ref < 10; ref++) {
74 #pragma omp teams distribute parallel for
75 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
76 for (int i; i < 10; i++)
80 #pragma omp teams distribute parallel for
81 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
82 for (int i = 0, j = 0; i < 10; ++i)
86 #pragma omp teams distribute parallel for
87 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
92 #pragma omp teams distribute parallel for
93 // expected-warning@+2 {{expression result unused}}
94 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
95 for (ii + 1; ii < 10; ++ii)
99 #pragma omp teams distribute parallel for
100 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
101 for (c[ii] = 0; ii < 10; ++ii)
105 #pragma omp teams distribute parallel for
106 // Ok to skip parenthesises.
107 for (((ii)) = 0; ii < 10; ++ii)
111 #pragma omp teams distribute parallel for
112 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
113 for (int i = 0; i; i++)
117 #pragma omp teams distribute parallel for
118 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
119 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
120 for (int i = 0; jj < kk; ii++)
124 #pragma omp teams distribute parallel for
125 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
126 for (int i = 0; !!i; i++)
131 #pragma omp teams distribute parallel for
132 for (int i = 0; i != 1; i++)
136 #pragma omp teams distribute parallel for
137 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
138 for (int i = 0;; i++)
143 #pragma omp teams distribute parallel for
144 for (int i = 11; i > 10; i--)
149 #pragma omp teams distribute parallel for
150 for (int i = 0; i < 10; ++i)
155 #pragma omp teams distribute parallel for
156 for (ii = 0; ii < 10; ++ii)
160 #pragma omp teams distribute parallel for
161 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
162 for (ii = 0; ii < 10; ++jj)
166 #pragma omp teams distribute parallel for
167 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
168 for (ii = 0; ii < 10; ++++ii)
171 // Ok but undefined behavior (in general, cannot check that incr
172 // is really loop-invariant).
174 #pragma omp teams distribute parallel for
175 for (ii = 0; ii < 10; ii = ii + ii)
179 #pragma omp teams distribute parallel for
180 // expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'float'}}
181 for (ii = 0; ii < 10; ii = ii + 1.0f)
184 // Ok - step was converted to integer type.
186 #pragma omp teams distribute parallel for
187 for (ii = 0; ii < 10; ii = ii + (int)1.1f)
191 #pragma omp teams distribute parallel for
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; jj = ii + 2)
197 #pragma omp teams distribute parallel for
198 // expected-warning@+2 {{relational comparison result unused}}
199 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
200 for (ii = 0; ii<10; jj> kk + 2)
204 #pragma omp teams distribute parallel for
205 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
206 for (ii = 0; ii < 10;)
210 #pragma omp teams distribute parallel for
211 // expected-warning@+2 {{expression result unused}}
212 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
213 for (ii = 0; ii < 10; !ii)
217 #pragma omp teams distribute parallel for
218 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
219 for (ii = 0; ii < 10; ii ? ++ii : ++jj)
223 #pragma omp teams distribute parallel for
224 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
225 for (ii = 0; ii < 10; ii = ii < 10)
229 #pragma omp teams distribute parallel for
230 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
231 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
232 for (ii = 0; ii < 10; ii = ii + 0)
236 #pragma omp teams distribute parallel for
237 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
238 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
239 for (ii = 0; ii < 10; ii = ii + (int)(0.8 - 0.45))
243 #pragma omp teams distribute parallel for
244 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
245 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
246 for (ii = 0; (ii) < 10; ii -= 25)
250 #pragma omp teams distribute parallel for
251 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
252 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
253 for (ii = 0; (ii < 10); ii -= 0)
257 #pragma omp teams distribute parallel for
258 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
259 // expected-error@+1 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
260 for (ii = 0; ii > 10; (ii += 0))
264 #pragma omp teams distribute parallel for
265 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
266 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
267 for (ii = 0; ii < 10; (ii) = (1 - 1) + (ii))
271 #pragma omp teams distribute parallel for
272 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
273 // expected-error@+1 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
274 for ((ii = 0); ii > 10; (ii -= 0))
278 #pragma omp teams distribute parallel for
279 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
280 // expected-error@+1 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
281 for (ii = 0; (ii < 10); (ii -= 0))
285 #pragma omp teams distribute parallel for firstprivate(ii) // expected-note {{defined as firstprivate}}
286 // expected-error@+1 {{loop iteration variable in the associated loop of 'omp teams distribute parallel for' directive may not be firstprivate, predetermined as private}}
287 for (ii = 0; ii < 10; ii++)
291 #pragma omp teams distribute parallel for private(ii) // OK
292 for (ii = 0; ii < 10; ii++)
296 #pragma omp teams distribute parallel for lastprivate(ii) // OK
297 for (ii = 0; ii < 10; ii++)
301 #pragma omp teams distribute parallel for
302 // expected-error@+1 {{loop iteration variable in the associated loop of 'omp teams distribute parallel for' directive may not be threadprivate or thread local, predetermined as private}}
303 for (sii = 0; sii < 10; sii++)
308 #pragma omp teams distribute parallel for collapse(2)
309 for (ii = 0; ii < 10; ii += 1)
310 for (globalii = 0; globalii < 10; globalii += 1)
311 c[globalii] += a[globalii] + ii;
315 #pragma omp teams distribute parallel for
316 // expected-error@+1 {{statement after '#pragma omp teams distribute parallel for' must be a for loop}}
317 for (auto &item : a) {
322 #pragma omp teams distribute parallel for
323 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
324 // expected-error@+1 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
325 for (unsigned i = 9; i < 10; i--) {
329 int(*lb)[4] = nullptr;
331 #pragma omp teams distribute parallel for
332 for (int(*p)[4] = lb; p < lb + 8; ++p) {
336 #pragma omp teams distribute parallel for
337 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
338 for (int a{0}; a < 10; ++a) {
344 // Iterators allowed in openmp for-loops.
346 struct random_access_iterator_tag {};
347 template <class Iter>
348 struct iterator_traits {
349 typedef typename Iter::difference_type difference_type;
350 typedef typename Iter::iterator_category iterator_category;
352 template <class Iter>
353 typename iterator_traits<Iter>::difference_type
354 distance(Iter first, Iter last) { return first - last; }
359 Iter0(const Iter0 &) {}
360 Iter0 operator++() { return *this; }
361 Iter0 operator--() { return *this; }
362 bool operator<(Iter0 a) { return true; }
364 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'Iter0' for 1st argument}}
365 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}}
366 int operator-(Iter0 a, Iter0 b) { return 0; }
369 Iter1(float f = 0.0f, double d = 0.0) {}
370 Iter1(const Iter1 &) {}
371 Iter1 operator++() { return *this; }
372 Iter1 operator--() { return *this; }
373 bool operator<(Iter1 a) { return true; }
374 bool operator>=(Iter1 a) { return false; }
379 GoodIter(const GoodIter &) {}
380 GoodIter(int fst, int snd) {}
381 GoodIter &operator=(const GoodIter &that) { return *this; }
382 GoodIter &operator=(const Iter0 &that) { return *this; }
383 GoodIter &operator+=(int x) { return *this; }
384 explicit GoodIter(void *) {}
385 GoodIter operator++() { return *this; }
386 GoodIter operator--() { return *this; }
387 bool operator!() { return true; }
388 bool operator<(GoodIter a) { return true; }
389 bool operator<=(GoodIter a) { return true; }
390 bool operator>=(GoodIter a) { return false; }
391 typedef int difference_type;
392 typedef std::random_access_iterator_tag iterator_category;
394 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'GoodIter' for 2nd argument}}
395 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
396 int operator-(GoodIter a, GoodIter b) { return 0; }
397 // expected-note@+1 3 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}}
398 GoodIter operator-(GoodIter a) { return a; }
399 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'int' for 2nd argument}}
400 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
401 GoodIter operator-(GoodIter a, int v) { return GoodIter(); }
402 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'GoodIter' for 1st argument}}
403 GoodIter operator+(GoodIter a, int v) { return GoodIter(); }
404 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'int' for 1st argument}}
405 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}}
406 GoodIter operator-(int v, GoodIter a) { return GoodIter(); }
407 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'int' for 1st argument}}
408 GoodIter operator+(int v, GoodIter a) { return GoodIter(); }
410 int test_with_random_access_iterator() {
414 #pragma omp teams distribute parallel for
415 for (GoodIter I = begin; I < end; ++I) // expected-warning 2 {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
418 #pragma omp teams distribute parallel for
419 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
420 for (GoodIter &I = begin; I < end; ++I)
423 #pragma omp teams distribute parallel for
424 for (GoodIter I = begin; I >= end; --I) // expected-warning 2 {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
427 #pragma omp teams distribute parallel for
428 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
429 for (GoodIter I(begin); I < end; ++I) // expected-warning 2 {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
432 #pragma omp teams distribute parallel for
433 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
434 for (GoodIter I(nullptr); I < end; ++I) // expected-warning {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
437 #pragma omp teams distribute parallel for
438 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
439 for (GoodIter I(0); I < end; ++I) // expected-warning {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
442 #pragma omp teams distribute parallel for
443 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
444 for (GoodIter I(1, 2); I < end; ++I) // expected-warning {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
447 #pragma omp teams distribute parallel for
448 for (begin = GoodIter(0); begin < end; ++begin) // expected-warning {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
451 #pragma omp teams distribute parallel for
452 // expected-error@+2 {{invalid operands to binary expression ('GoodIter' and 'const Iter0')}}
453 // expected-error@+1 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
454 for (begin = begin0; begin < end; ++begin)
457 #pragma omp teams distribute parallel for
458 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
459 for (++begin; begin < end; ++begin)
462 #pragma omp teams distribute parallel for
463 for (begin = end; begin < end; ++begin) // expected-warning {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
466 #pragma omp teams distribute parallel for
467 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
468 for (GoodIter I = begin; I - I; ++I)
471 #pragma omp teams distribute parallel for
472 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
473 for (GoodIter I = begin; begin < end; ++I)
476 #pragma omp teams distribute parallel for
477 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
478 for (GoodIter I = begin; !I; ++I)
481 #pragma omp teams distribute parallel for
482 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
483 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
484 for (GoodIter I = begin; I >= end; I = I + 1)
487 #pragma omp teams distribute parallel for
488 for (GoodIter I = begin; I >= end; I = I - 1) // expected-warning 2 {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
491 #pragma omp teams distribute parallel for
492 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
493 for (GoodIter I = begin; I >= end; I = -I)
496 #pragma omp teams distribute parallel for
497 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
498 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
499 for (GoodIter I = begin; I >= end; I = 2 + I)
502 #pragma omp teams distribute parallel for
503 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
504 for (GoodIter I = begin; I >= end; I = 2 - I)
507 #pragma omp teams distribute parallel for
508 // expected-error@+1 {{invalid operands to binary expression ('Iter0' and 'int')}}
509 for (Iter0 I = begin0; I < end0; ++I)
512 #pragma omp teams distribute parallel for
513 // Initializer is constructor without params.
514 // expected-error@+2 {{invalid operands to binary expression ('Iter0' and 'int')}}
515 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
516 for (Iter0 I; I < end0; ++I)
520 #pragma omp teams distribute parallel for
521 // expected-error@+2 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
522 // expected-error@+1 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
523 for (Iter1 I = begin1; I < end1; ++I)
526 #pragma omp teams distribute parallel for
527 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
528 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
529 for (Iter1 I = begin1; I >= end1; ++I)
532 #pragma omp teams distribute parallel for
533 // expected-error@+4 {{invalid operands to binary expression ('Iter1' and 'float')}}
534 // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
535 // Initializer is constructor with all default params.
536 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
537 for (Iter1 I; I < end1; ++I) {
542 template <typename IT, int ST>
545 int dotest_lt(IT begin, IT end) {
547 #pragma omp teams distribute parallel for
548 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
549 // expected-error@+1 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
550 for (IT I = begin; I < end; I = I + ST) { // expected-warning 2 {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
554 #pragma omp teams distribute parallel for
555 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
556 // expected-error@+1 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
557 for (IT I = begin; I <= end; I += ST) { // expected-warning 2 {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
561 #pragma omp teams distribute parallel for
562 for (IT I = begin; I < end; ++I) { // expected-warning 4 {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
571 template <typename IT, int ST = 0>
572 int dotest_gt(IT begin, IT end) {
574 #pragma omp teams distribute parallel for
575 // expected-note@+2 2 {{loop step is expected to be negative due to this condition}}
576 // expected-error@+1 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
577 for (IT I = begin; I >= end; I = I + ST) {
581 #pragma omp teams distribute parallel for
582 // expected-note@+2 2 {{loop step is expected to be negative due to this condition}}
583 // expected-error@+1 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
584 for (IT I = begin; I >= end; I += ST) {
589 #pragma omp teams distribute parallel for
590 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
591 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
592 for (IT I = begin; I >= end; ++I) {
597 #pragma omp teams distribute parallel for
598 for (IT I = begin; I < end; I += TC<int, ST>::step()) { // expected-warning 2 {{Non-trivial type 'GoodIter' is mapped, only trivial types are guaranteed to be mapped correctly}}
603 void test_with_template() {
605 TC<GoodIter, 100> t1;
606 TC<GoodIter, -100> t2;
607 t1.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, 100>::dotest_lt' requested here}}
608 t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
609 dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
610 dotest_gt<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
613 void test_loop_break() {
615 float a[N], b[N], c[N];
617 #pragma omp teams distribute parallel for
618 for (int i = 0; i < 10; i++) {
620 for (int j = 0; j < 10; ++j) {
622 break; // OK in nested loop
632 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
635 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
639 #pragma omp teams distribute parallel for
640 for (int i = 0; i < 10; i++) {
641 for (int j = 0; j < 10; j++) {
652 void test_loop_eh() {
654 float a[N], b[N], c[N];
656 #pragma omp teams distribute parallel for
657 for (int i = 0; i < 10; i++) {
660 for (int j = 0; j < 10; ++j) {
668 return; // expected-error {{cannot return from OpenMP region}}
677 for (int j = 0; j < 10; j++) {
686 #pragma omp teams distribute parallel for
687 for (int i = 0; i < 10; ++i) {
689 void g() { throw 0; }
694 void test_loop_firstprivate_lastprivate() {
696 // expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
698 #pragma omp teams distribute parallel for lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}} expected-warning {{Non-trivial type 'S' is mapped, only trivial types are guaranteed to be mapped correctly}}
699 for (int i = 0; i < 16; ++i)
703 void test_ordered() {
705 #pragma omp teams distribute parallel for ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp teams distribute parallel for'}}
706 for (int i = 0; i < 16; ++i)
712 // expected-error@+1 2 {{unexpected OpenMP clause 'nowait' in directive '#pragma omp teams distribute parallel for'}}
713 #pragma omp teams distribute parallel for nowait nowait // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'nowait' clause}}
714 for (int i = 0; i < 16; ++i)