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];
27 #pragma omp distribute parallel for simd
28 for (int i = 0; i < 10; i += 1) {
33 #pragma omp distribute parallel for simd
34 for (char i = 0; i < 10; i++) {
39 #pragma omp distribute parallel for simd
40 for (char i = 0; i < 10; i += '\1') {
45 #pragma omp distribute parallel for simd
46 for (long long i = 0; i < 10; i++) {
51 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'double'}}
52 #pragma omp distribute parallel for simd
53 for (long long i = 0; i < 10; i += 1.5) {
58 #pragma omp distribute parallel for simd
59 for (long long i = 0; i < 'z'; i += 1u) {
64 // expected-error@+2 {{variable must be of integer or random access iterator type}}
65 #pragma omp distribute parallel for simd
66 for (float fi = 0; fi < 10.0; fi++) {
67 c[(int)fi] = a[(int)fi] + b[(int)fi];
71 // expected-error@+2 {{variable must be of integer or random access iterator type}}
72 #pragma omp distribute parallel for simd
73 for (double fi = 0; fi < 10.0; fi++) {
74 c[(int)fi] = a[(int)fi] + b[(int)fi];
78 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
79 #pragma omp distribute parallel for simd
80 for (int &ref = ii; ref < 10; ref++) {
84 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
85 #pragma omp distribute parallel for simd
86 for (int i; i < 10; i++)
91 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
92 #pragma omp distribute parallel for simd
93 for (int i = 0, j = 0; i < 10; ++i)
98 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
99 #pragma omp distribute parallel for simd
100 for (; ii < 10; ++ii)
105 // expected-warning@+3 {{expression result unused}}
106 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
107 #pragma omp distribute parallel for simd
108 for (ii + 1; ii < 10; ++ii)
113 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
114 #pragma omp distribute parallel for simd
115 for (c[ii] = 0; ii < 10; ++ii)
120 // Ok to skip parenthesises.
121 #pragma omp distribute parallel for simd
122 for (((ii)) = 0; ii < 10; ++ii)
127 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
128 #pragma omp distribute parallel for simd
129 for (int i = 0; i; i++)
134 // expected-error@+3 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
135 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
136 #pragma omp distribute parallel for simd
137 for (int i = 0; jj < kk; ii++)
142 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
143 #pragma omp distribute parallel for simd
144 for (int i = 0; !!i; i++)
149 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
150 #pragma omp distribute parallel for simd
151 for (int i = 0; i != 1; i++)
156 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
157 #pragma omp distribute parallel for simd
158 for (int i = 0;; i++)
164 #pragma omp distribute parallel for simd
165 for (int i = 11; i > 10; i--)
171 #pragma omp distribute parallel for simd
172 for (int i = 0; i < 10; ++i)
178 #pragma omp distribute parallel for simd
179 for (ii = 0; ii < 10; ++ii)
184 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
185 #pragma omp distribute parallel for simd
186 for (ii = 0; ii < 10; ++jj)
191 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
192 #pragma omp distribute parallel for simd
193 for (ii = 0; ii < 10; ++++ii)
196 // Ok but undefined behavior (in general, cannot check that incr
197 // is really loop-invariant).
200 #pragma omp distribute parallel for simd
201 for (ii = 0; ii < 10; ii = ii + ii)
206 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'float'}}
207 #pragma omp distribute parallel for simd
208 for (ii = 0; ii < 10; ii = ii + 1.0f)
211 // Ok - step was converted to integer type.
214 #pragma omp distribute parallel for simd
215 for (ii = 0; ii < 10; ii = ii + (int)1.1f)
220 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
221 #pragma omp distribute parallel for simd
222 for (ii = 0; ii < 10; jj = ii + 2)
227 // expected-warning@+3 {{relational comparison result unused}}
228 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
229 #pragma omp distribute parallel for simd
230 for (ii = 0; ii<10; jj> kk + 2)
235 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
236 #pragma omp distribute parallel for simd
237 for (ii = 0; ii < 10;)
242 // expected-warning@+3 {{expression result unused}}
243 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
244 #pragma omp distribute parallel for simd
245 for (ii = 0; ii < 10; !ii)
250 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
251 #pragma omp distribute parallel for simd
252 for (ii = 0; ii < 10; ii ? ++ii : ++jj)
257 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
258 #pragma omp distribute parallel for simd
259 for (ii = 0; ii < 10; ii = ii < 10)
264 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
265 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
266 #pragma omp distribute parallel for simd
267 for (ii = 0; ii < 10; ii = ii + 0)
272 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
273 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
274 #pragma omp distribute parallel for simd
275 for (ii = 0; ii < 10; ii = ii + (int)(0.8 - 0.45))
280 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
281 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
282 #pragma omp distribute parallel for simd
283 for (ii = 0; (ii) < 10; ii -= 25)
288 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
289 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
290 #pragma omp distribute parallel for simd
291 for (ii = 0; (ii < 10); ii -= 0)
296 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
297 // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
298 #pragma omp distribute parallel for simd
299 for (ii = 0; ii > 10; (ii += 0))
304 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
305 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
306 #pragma omp distribute parallel for simd
307 for (ii = 0; ii < 10; (ii) = (1 - 1) + (ii))
312 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
313 // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
314 #pragma omp distribute parallel for simd
315 for ((ii = 0); ii > 10; (ii -= 0))
320 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
321 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
322 #pragma omp distribute parallel for simd
323 for (ii = 0; (ii < 10); (ii -= 0))
328 // expected-note@+2 {{defined as firstprivate}}
329 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp distribute parallel for simd' directive may not be firstprivate, predetermined as linear}}
330 #pragma omp distribute parallel for simd firstprivate(ii)
331 for (ii = 0; ii < 10; ii++)
336 #pragma omp distribute parallel for simd linear(ii)
337 for (ii = 0; ii < 10; ii++)
342 // expected-note@+2 {{defined as private}}
343 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp distribute parallel for simd' directive may not be private, predetermined as linear}}
344 #pragma omp distribute parallel for simd private(ii)
345 for (ii = 0; ii < 10; ii++)
350 // expected-note@+2 {{defined as lastprivate}}
351 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp distribute parallel for simd' directive may not be lastprivate, predetermined as linear}}
352 #pragma omp distribute parallel for simd lastprivate(ii)
353 for (ii = 0; ii < 10; ii++)
357 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp distribute parallel for simd' directive may not be threadprivate or thread local, predetermined as linear}}
358 #pragma omp distribute parallel for simd
359 for (sii = 0; sii < 10; sii += 1)
364 #pragma omp distribute parallel for simd
365 for (globalii = 0; globalii < 10; globalii += 1)
366 c[globalii] = a[globalii];
372 #pragma omp distribute parallel for simd collapse(2)
373 for (ii = 0; ii < 10; ii += 1)
374 for (globalii = 0; globalii < 10; globalii += 1)
375 c[globalii] += a[globalii] + ii;
380 // expected-error@+2 {{statement after '#pragma omp distribute parallel for simd' must be a for loop}}
381 #pragma omp distribute parallel for simd
382 for (auto &item : a) {
388 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
389 // expected-error@+2 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
390 #pragma omp distribute parallel for simd
391 for (unsigned i = 9; i < 10; i--) {
395 int(*lb)[4] = nullptr;
398 #pragma omp distribute parallel for simd
399 for (int(*p)[4] = lb; p < lb + 8; ++p) {
404 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
405 #pragma omp distribute parallel for simd
406 for (int a{0}; a < 10; ++a) {
412 // Iterators allowed in openmp for-loops.
414 struct random_access_iterator_tag {};
415 template <class Iter>
416 struct iterator_traits {
417 typedef typename Iter::difference_type difference_type;
418 typedef typename Iter::iterator_category iterator_category;
420 template <class Iter>
421 typename iterator_traits<Iter>::difference_type
422 distance(Iter first, Iter last) { return first - last; }
427 Iter0(const Iter0 &) {}
428 Iter0 operator++() { return *this; }
429 Iter0 operator--() { return *this; }
430 bool operator<(Iter0 a) { return true; }
432 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'Iter0' for 1st argument}}
433 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}}
434 int operator-(Iter0 a, Iter0 b) { return 0; }
437 Iter1(float f = 0.0f, double d = 0.0) {}
438 Iter1(const Iter1 &) {}
439 Iter1 operator++() { return *this; }
440 Iter1 operator--() { return *this; }
441 bool operator<(Iter1 a) { return true; }
442 bool operator>=(Iter1 a) { return false; }
447 GoodIter(const GoodIter &) {}
448 GoodIter(int fst, int snd) {}
449 GoodIter &operator=(const GoodIter &that) { return *this; }
450 GoodIter &operator=(const Iter0 &that) { return *this; }
451 GoodIter &operator+=(int x) { return *this; }
452 explicit GoodIter(void *) {}
453 GoodIter operator++() { return *this; }
454 GoodIter operator--() { return *this; }
455 bool operator!() { return true; }
456 bool operator<(GoodIter a) { return true; }
457 bool operator<=(GoodIter a) { return true; }
458 bool operator>=(GoodIter a) { return false; }
459 typedef int difference_type;
460 typedef std::random_access_iterator_tag iterator_category;
462 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'GoodIter' for 2nd argument}}
463 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
464 int operator-(GoodIter a, GoodIter b) { return 0; }
465 // expected-note@+1 3 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}}
466 GoodIter operator-(GoodIter a) { return a; }
467 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'int' for 2nd argument}}
468 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
469 GoodIter operator-(GoodIter a, int v) { return GoodIter(); }
470 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'GoodIter' for 1st argument}}
471 GoodIter operator+(GoodIter a, int v) { return GoodIter(); }
472 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'int' for 1st argument}}
473 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}}
474 GoodIter operator-(int v, GoodIter a) { return GoodIter(); }
475 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'int' for 1st argument}}
476 GoodIter operator+(int v, GoodIter a) { return GoodIter(); }
478 int test_with_random_access_iterator() {
483 #pragma omp distribute parallel for simd
484 for (GoodIter I = begin; I < end; ++I)
488 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
489 #pragma omp distribute parallel for simd
490 for (GoodIter &I = begin; I < end; ++I)
494 #pragma omp distribute parallel for simd
495 for (GoodIter I = begin; I >= end; --I)
499 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
500 #pragma omp distribute parallel for simd
501 for (GoodIter I(begin); I < end; ++I)
505 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
506 #pragma omp distribute parallel for simd
507 for (GoodIter I(nullptr); I < end; ++I)
511 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
512 #pragma omp distribute parallel for simd
513 for (GoodIter I(0); I < end; ++I)
517 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
518 #pragma omp distribute parallel for simd
519 for (GoodIter I(1, 2); I < end; ++I)
523 #pragma omp distribute parallel for simd
524 for (begin = GoodIter(0); begin < end; ++begin)
528 // expected-error@+3 {{invalid operands to binary expression ('GoodIter' and 'const Iter0')}}
529 // expected-error@+2 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
530 #pragma omp distribute parallel for simd
531 for (begin = begin0; begin < end; ++begin)
535 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
536 #pragma omp distribute parallel for simd
537 for (++begin; begin < end; ++begin)
541 #pragma omp distribute parallel for simd
542 for (begin = end; begin < end; ++begin)
546 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
547 #pragma omp distribute parallel for simd
548 for (GoodIter I = begin; I - I; ++I)
552 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
553 #pragma omp distribute parallel for simd
554 for (GoodIter I = begin; begin < end; ++I)
558 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
559 #pragma omp distribute parallel for simd
560 for (GoodIter I = begin; !I; ++I)
564 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
565 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
566 #pragma omp distribute parallel for simd
567 for (GoodIter I = begin; I >= end; I = I + 1)
571 #pragma omp distribute parallel for simd
572 for (GoodIter I = begin; I >= end; I = I - 1)
576 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
577 #pragma omp distribute parallel for simd
578 for (GoodIter I = begin; I >= end; I = -I)
582 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
583 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
584 #pragma omp distribute parallel for simd
585 for (GoodIter I = begin; I >= end; I = 2 + I)
589 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
590 #pragma omp distribute parallel for simd
591 for (GoodIter I = begin; I >= end; I = 2 - I)
595 // expected-error@+2 {{invalid operands to binary expression ('Iter0' and 'int')}}
596 #pragma omp distribute parallel for simd
597 for (Iter0 I = begin0; I < end0; ++I)
601 // Initializer is constructor without params.
602 // expected-error@+3 {{invalid operands to binary expression ('Iter0' and 'int')}}
603 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
604 #pragma omp distribute parallel for simd
605 for (Iter0 I; I < end0; ++I)
610 // expected-error@+3 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
611 // expected-error@+2 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
612 #pragma omp distribute parallel for simd
613 for (Iter1 I = begin1; I < end1; ++I)
617 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
618 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
619 #pragma omp distribute parallel for simd
620 for (Iter1 I = begin1; I >= end1; ++I)
624 // expected-error@+5 {{invalid operands to binary expression ('Iter1' and 'float')}}
625 // expected-error@+4 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
626 // Initializer is constructor with all default params.
627 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
628 #pragma omp distribute parallel for simd
629 for (Iter1 I; I < end1; ++I) {
634 template <typename IT, int ST>
637 int dotest_lt(IT begin, IT end) {
640 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
641 // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
642 #pragma omp distribute parallel for simd
643 for (IT I = begin; I < end; I = I + ST) {
648 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
649 // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
650 #pragma omp distribute parallel for simd
651 for (IT I = begin; I <= end; I += ST) {
656 #pragma omp distribute parallel for simd
657 for (IT I = begin; I < end; ++I) {
666 template <typename IT, int ST = 0>
667 int dotest_gt(IT begin, IT end) {
670 // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
671 // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
672 #pragma omp distribute parallel for simd
673 for (IT I = begin; I >= end; I = I + ST) {
678 // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
679 // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
680 #pragma omp distribute parallel for simd
681 for (IT I = begin; I >= end; I += ST) {
687 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
688 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
689 #pragma omp distribute parallel for simd
690 for (IT I = begin; I >= end; ++I) {
694 #pragma omp distribute parallel for simd
695 for (IT I = begin; I < end; I += TC<int, ST>::step()) {
700 void test_with_template() {
702 TC<GoodIter, 100> t1;
703 TC<GoodIter, -100> t2;
704 t1.dotest_lt(begin, end);
705 t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
706 dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
707 dotest_gt<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
710 void test_loop_break() {
712 float a[N], b[N], c[N];
715 #pragma omp distribute parallel for simd
716 for (int i = 0; i < 10; i++) {
718 for (int j = 0; j < 10; ++j) {
720 break; // OK in nested loop
730 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
733 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
738 #pragma omp distribute parallel for simd
739 for (int i = 0; i < 10; i++) {
740 for (int j = 0; j < 10; j++) {
751 void test_loop_eh() {
753 float a[N], b[N], c[N];
756 #pragma omp distribute parallel for simd
757 for (int i = 0; i < 10; i++) {
759 try { // expected-error {{'try' statement cannot be used in OpenMP simd region}}
760 for (int j = 0; j < 10; ++j) {
762 throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
764 throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
767 throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
768 return; // expected-error {{cannot return from OpenMP region}}
777 for (int j = 0; j < 10; j++) {
779 throw c[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
785 #pragma omp distribute parallel for simd
786 for (int i = 0; i < 10; ++i) {
788 void g() { throw 0; }
793 void test_loop_firstprivate_lastprivate() {
795 // expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
798 #pragma omp distribute parallel for simd lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
799 for (int i = 0; i < 16; ++i)
803 void test_ordered() {
806 #pragma omp distribute parallel for simd ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp distribute parallel for simd'}}
807 for (int i = 0; i < 16; ++i)
814 // expected-error@+1 2 {{unexpected OpenMP clause 'nowait' in directive '#pragma omp distribute parallel for simd'}}
815 #pragma omp distribute parallel for simd nowait nowait // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'nowait' clause}}
816 for (int i = 0; i < 16; ++i)