1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s -Wno-openmp-target
3 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s -Wno-openmp-target
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];
25 #pragma omp target teams distribute parallel for simd
26 for (int i = 0; i < 10; i += 1) {
29 #pragma omp target teams distribute parallel for simd
30 for (char i = 0; i < 10; i++) {
33 #pragma omp target teams distribute parallel for simd
34 for (char i = 0; i < 10; i += '\1') {
37 #pragma omp target teams distribute parallel for simd
38 for (long long i = 0; i < 10; i++) {
41 #pragma omp target teams distribute parallel for simd
42 // expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'double'}}
43 for (long long i = 0; i < 10; i += 1.5) {
46 #pragma omp target teams distribute parallel for simd
47 for (long long i = 0; i < 'z'; i += 1u) {
50 #pragma omp target teams distribute parallel for simd
51 // expected-error@+1 {{variable must be of integer or random access iterator type}}
52 for (float fi = 0; fi < 10.0; fi++) {
53 c[(int)fi] = a[(int)fi] + b[(int)fi];
55 #pragma omp target teams distribute parallel for simd
56 // expected-error@+1 {{variable must be of integer or random access iterator type}}
57 for (double fi = 0; fi < 10.0; fi++) {
58 c[(int)fi] = a[(int)fi] + b[(int)fi];
60 #pragma omp target teams distribute parallel for simd
61 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
62 for (int &ref = ii; ref < 10; ref++) {
64 #pragma omp target teams distribute parallel for simd
65 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
66 for (int i; i < 10; i++)
69 #pragma omp target teams distribute parallel for simd
70 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
71 for (int i = 0, j = 0; i < 10; ++i)
74 #pragma omp target teams distribute parallel for simd
75 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
79 #pragma omp target teams distribute parallel for simd
80 // expected-warning@+2 {{expression result unused}}
81 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
82 for (ii + 1; ii < 10; ++ii)
85 #pragma omp target teams distribute parallel for simd
86 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
87 for (c[ii] = 0; ii < 10; ++ii)
90 #pragma omp target teams distribute parallel for simd
91 // Ok to skip parenthesises.
92 for (((ii)) = 0; ii < 10; ++ii)
95 #pragma omp target teams distribute parallel for simd
96 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
97 for (int i = 0; i; i++)
100 #pragma omp target teams distribute parallel for simd
101 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
102 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
103 for (int i = 0; jj < kk; ii++)
106 #pragma omp target teams distribute parallel for simd
107 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
108 for (int i = 0; !!i; i++)
112 #pragma omp target teams distribute parallel for simd
113 for (int i = 0; i != 1; i++)
116 #pragma omp target teams distribute parallel for simd
117 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
118 for (int i = 0;; i++)
122 #pragma omp target teams distribute parallel for simd
123 for (int i = 11; i > 10; i--)
127 #pragma omp target teams distribute parallel for simd
128 for (int i = 0; i < 10; ++i)
132 #pragma omp target teams distribute parallel for simd
133 for (ii = 0; ii < 10; ++ii)
136 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
137 #pragma omp target teams distribute parallel for simd
138 for (ii = 0; ii < 10; ++jj)
141 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
142 #pragma omp target teams distribute parallel for simd
143 for (ii = 0; ii < 10; ++++ii)
146 // Ok but undefined behavior (in general, cannot check that incr
147 // is really loop-invariant).
148 #pragma omp target teams distribute parallel for simd
149 for (ii = 0; ii < 10; ii = ii + ii)
152 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'float'}}
153 #pragma omp target teams distribute parallel for simd
154 for (ii = 0; ii < 10; ii = ii + 1.0f)
157 // Ok - step was converted to integer type.
158 #pragma omp target teams distribute parallel for simd
159 for (ii = 0; ii < 10; ii = ii + (int)1.1f)
162 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
163 #pragma omp target teams distribute parallel for simd
164 for (ii = 0; ii < 10; jj = ii + 2)
167 // expected-warning@+3 {{relational comparison result unused}}
168 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
169 #pragma omp target teams distribute parallel for simd
170 for (ii = 0; ii<10; jj> kk + 2)
173 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
174 #pragma omp target teams distribute parallel for simd
175 for (ii = 0; ii < 10;)
178 // expected-warning@+3 {{expression result unused}}
179 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
180 #pragma omp target teams distribute parallel for simd
181 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 target teams distribute parallel for simd
186 for (ii = 0; ii < 10; ii ? ++ii : ++jj)
189 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
190 #pragma omp target teams distribute parallel for simd
191 for (ii = 0; ii < 10; ii = ii < 10)
194 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
195 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
196 #pragma omp target teams distribute parallel for simd
197 for (ii = 0; ii < 10; ii = ii + 0)
200 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
201 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
202 #pragma omp target teams distribute parallel for simd
203 for (ii = 0; ii < 10; ii = ii + (int)(0.8 - 0.45))
206 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
207 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
208 #pragma omp target teams distribute parallel for simd
209 for (ii = 0; (ii) < 10; ii -= 25)
212 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
213 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
214 #pragma omp target teams distribute parallel for simd
215 for (ii = 0; (ii < 10); ii -= 0)
218 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
219 // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
220 #pragma omp target teams distribute parallel for simd
221 for (ii = 0; ii > 10; (ii += 0))
224 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
225 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
226 #pragma omp target teams distribute parallel for simd
227 for (ii = 0; ii < 10; (ii) = (1 - 1) + (ii))
230 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
231 // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
232 #pragma omp target teams distribute parallel for simd
233 for ((ii = 0); ii > 10; (ii -= 0))
236 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
237 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
238 #pragma omp target teams distribute parallel for simd
239 for (ii = 0; (ii < 10); (ii -= 0))
242 // expected-error@+3 {{loop iteration variable in the associated loop of 'omp target teams distribute parallel for simd' directive may not be firstprivate, predetermined as linear}}
243 // expected-note@+1 {{defined as firstprivate}}
244 #pragma omp target teams distribute parallel for simd firstprivate(ii)
245 for (ii = 0; ii < 10; ii++)
248 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp target teams distribute parallel for simd' directive may not be private, predetermined as linear}}
249 #pragma omp target teams distribute parallel for simd private(ii) // expected-note {{defined as private}}
250 for (ii = 0; ii < 10; ii++)
253 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp target teams distribute parallel for simd' directive may not be lastprivate, predetermined as linear}}
254 #pragma omp target teams distribute parallel for simd lastprivate(ii) // expected-note {{defined as lastprivate}}
255 for (ii = 0; ii < 10; ii++)
258 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp target teams distribute parallel for simd' directive may not be threadprivate or thread local, predetermined as linear}}
259 #pragma omp target teams distribute parallel for simd
260 for (sii = 0; sii < 10; sii++)
264 #pragma omp target teams distribute parallel for simd collapse(2)
265 for (ii = 0; ii < 10; ii += 1)
266 for (globalii = 0; globalii < 10; globalii += 1)
267 c[globalii] += a[globalii] + ii;
270 // expected-error@+2 {{statement after '#pragma omp target teams distribute parallel for simd' must be a for loop}}
271 #pragma omp target teams distribute parallel for simd
272 for (auto &item : a) {
276 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
277 // expected-error@+2 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
278 #pragma omp target teams distribute parallel for simd
279 for (unsigned i = 9; i < 10; i--) {
283 int(*lb)[4] = nullptr;
284 #pragma omp target teams distribute parallel for simd
285 for (int(*p)[4] = lb; p < lb + 8; ++p) {
288 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
289 #pragma omp target teams distribute parallel for simd
290 for (int a{0}; a < 10; ++a) {
296 // Iterators allowed in openmp for-loops.
298 struct random_access_iterator_tag {};
299 template <class Iter>
300 struct iterator_traits {
301 typedef typename Iter::difference_type difference_type;
302 typedef typename Iter::iterator_category iterator_category;
304 template <class Iter>
305 typename iterator_traits<Iter>::difference_type
306 distance(Iter first, Iter last) { return first - last; }
311 Iter0(const Iter0 &) {}
312 Iter0 operator++() { return *this; }
313 Iter0 operator--() { return *this; }
314 bool operator<(Iter0 a) { return true; }
316 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'Iter0' for 1st argument}}
317 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}}
318 int operator-(Iter0 a, Iter0 b) { return 0; }
321 Iter1(float f = 0.0f, double d = 0.0) {}
322 Iter1(const Iter1 &) {}
323 Iter1 operator++() { return *this; }
324 Iter1 operator--() { return *this; }
325 bool operator<(Iter1 a) { return true; }
326 bool operator>=(Iter1 a) { return false; }
331 GoodIter(const GoodIter &) {}
332 GoodIter(int fst, int snd) {}
333 GoodIter &operator=(const GoodIter &that) { return *this; }
334 GoodIter &operator=(const Iter0 &that) { return *this; }
335 GoodIter &operator+=(int x) { return *this; }
336 explicit GoodIter(void *) {}
337 GoodIter operator++() { return *this; }
338 GoodIter operator--() { return *this; }
339 bool operator!() { return true; }
340 bool operator<(GoodIter a) { return true; }
341 bool operator<=(GoodIter a) { return true; }
342 bool operator>=(GoodIter a) { return false; }
343 typedef int difference_type;
344 typedef std::random_access_iterator_tag iterator_category;
346 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'GoodIter' for 2nd argument}}
347 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
348 int operator-(GoodIter a, GoodIter b) { return 0; }
349 // expected-note@+1 3 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}}
350 GoodIter operator-(GoodIter a) { return a; }
351 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'int' for 2nd argument}}
352 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
353 GoodIter operator-(GoodIter a, int v) { return GoodIter(); }
354 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'GoodIter' for 1st argument}}
355 GoodIter operator+(GoodIter a, int v) { return GoodIter(); }
356 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'int' for 1st argument}}
357 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}}
358 GoodIter operator-(int v, GoodIter a) { return GoodIter(); }
359 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'int' for 1st argument}}
360 GoodIter operator+(int v, GoodIter a) { return GoodIter(); }
362 int test_with_random_access_iterator() {
365 #pragma omp target teams distribute parallel for simd
366 for (GoodIter I = begin; I < end; ++I)
368 #pragma omp target teams distribute parallel for simd
369 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
370 for (GoodIter &I = begin; I < end; ++I)
372 #pragma omp target teams distribute parallel for simd
373 for (GoodIter I = begin; I >= end; --I)
375 #pragma omp target teams distribute parallel for simd
376 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
377 for (GoodIter I(begin); I < end; ++I)
379 #pragma omp target teams distribute parallel for simd
380 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
381 for (GoodIter I(nullptr); I < end; ++I)
383 #pragma omp target teams distribute parallel for simd
384 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
385 for (GoodIter I(0); I < end; ++I)
387 #pragma omp target teams distribute parallel for simd
388 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
389 for (GoodIter I(1, 2); I < end; ++I)
391 #pragma omp target teams distribute parallel for simd
392 for (begin = GoodIter(0); begin < end; ++begin)
394 #pragma omp target teams distribute parallel for simd
395 // expected-error@+2 {{invalid operands to binary expression ('GoodIter' and 'const Iter0')}}
396 // expected-error@+1 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
397 for (begin = begin0; begin < end; ++begin)
399 #pragma omp target teams distribute parallel for simd
400 // expected-error@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
401 for (++begin; begin < end; ++begin)
403 #pragma omp target teams distribute parallel for simd
404 for (begin = end; begin < end; ++begin)
406 #pragma omp target teams distribute parallel for simd
407 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
408 for (GoodIter I = begin; I - I; ++I)
410 #pragma omp target teams distribute parallel for simd
411 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
412 for (GoodIter I = begin; begin < end; ++I)
414 #pragma omp target teams distribute parallel for simd
415 // expected-error@+1 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
416 for (GoodIter I = begin; !I; ++I)
418 #pragma omp target teams distribute parallel for simd
419 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
420 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
421 for (GoodIter I = begin; I >= end; I = I + 1)
423 #pragma omp target teams distribute parallel for simd
424 for (GoodIter I = begin; I >= end; I = I - 1)
426 #pragma omp target teams distribute parallel for simd
427 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
428 for (GoodIter I = begin; I >= end; I = -I)
430 #pragma omp target teams distribute parallel for simd
431 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
432 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
433 for (GoodIter I = begin; I >= end; I = 2 + I)
435 #pragma omp target teams distribute parallel for simd
436 // expected-error@+1 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
437 for (GoodIter I = begin; I >= end; I = 2 - I)
439 #pragma omp target teams distribute parallel for simd
440 // expected-error@+1 {{invalid operands to binary expression ('Iter0' and 'int')}}
441 for (Iter0 I = begin0; I < end0; ++I)
443 #pragma omp target teams distribute parallel for simd
444 // Initializer is constructor without params.
445 // expected-error@+2 {{invalid operands to binary expression ('Iter0' and 'int')}}
446 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
447 for (Iter0 I; I < end0; ++I)
450 #pragma omp target teams distribute parallel for simd
451 // expected-error@+2 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
452 // expected-error@+1 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
453 for (Iter1 I = begin1; I < end1; ++I)
455 #pragma omp target teams distribute parallel for simd
456 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
457 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
458 for (Iter1 I = begin1; I >= end1; ++I)
460 #pragma omp target teams distribute parallel for simd
461 // expected-error@+4 {{invalid operands to binary expression ('Iter1' and 'float')}}
462 // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
463 // Initializer is constructor with all default params.
464 // expected-warning@+1 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
465 for (Iter1 I; I < end1; ++I) {
470 template <typename IT, int ST>
473 int dotest_lt(IT begin, IT end) {
474 #pragma omp target teams distribute parallel for simd
475 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
476 // expected-error@+1 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
477 for (IT I = begin; I < end; I = I + ST) {
480 #pragma omp target teams distribute parallel for simd
481 // expected-note@+2 {{loop step is expected to be positive due to this condition}}
482 // expected-error@+1 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
483 for (IT I = begin; I <= end; I += ST) {
486 #pragma omp target teams distribute parallel for simd
487 for (IT I = begin; I < end; ++I) {
496 template <typename IT, int ST = 0>
497 int dotest_gt(IT begin, IT end) {
498 #pragma omp target teams distribute parallel for simd
499 // expected-note@+2 2 {{loop step is expected to be negative due to this condition}}
500 // expected-error@+1 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
501 for (IT I = begin; I >= end; I = I + ST) {
504 #pragma omp target teams distribute parallel for simd
505 // expected-note@+2 2 {{loop step is expected to be negative due to this condition}}
506 // expected-error@+1 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
507 for (IT I = begin; I >= end; I += ST) {
511 #pragma omp target teams distribute parallel for simd
512 // expected-note@+2 {{loop step is expected to be negative due to this condition}}
513 // expected-error@+1 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
514 for (IT I = begin; I >= end; ++I) {
518 #pragma omp target teams distribute parallel for simd
519 for (IT I = begin; I < end; I += TC<int, ST>::step()) {
524 void test_with_template() {
526 TC<GoodIter, 100> t1;
527 TC<GoodIter, -100> t2;
528 t1.dotest_lt(begin, end);
529 t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
530 dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
531 dotest_gt<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
534 void test_loop_break() {
536 float a[N], b[N], c[N];
537 #pragma omp target teams distribute parallel for simd
538 for (int i = 0; i < 10; i++) {
540 for (int j = 0; j < 10; ++j) {
542 break; // OK in nested loop
552 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
555 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
558 #pragma omp target teams distribute parallel for simd
559 for (int i = 0; i < 10; i++) {
560 for (int j = 0; j < 10; j++) {
571 void test_loop_eh() {
573 float a[N], b[N], c[N];
574 #pragma omp target teams distribute parallel for simd
575 for (int i = 0; i < 10; i++) {
577 try { // expected-error {{'try' statement cannot be used in OpenMP simd region}}
578 for (int j = 0; j < 10; ++j) {
580 throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
582 throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
585 throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
586 return; // expected-error {{cannot return from OpenMP region}}
595 for (int j = 0; j < 10; j++) {
597 throw c[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
603 #pragma omp target teams distribute parallel for simd
604 for (int i = 0; i < 10; ++i) {
606 void g() { throw 0; }
611 void test_loop_firstprivate_lastprivate() {
613 // expected-error@+1 {{lastprivate variable cannot be firstprivate}} expected-note@+1 {{defined as lastprivate}}
614 #pragma omp target teams distribute parallel for simd lastprivate(s) firstprivate(s) // expected-error {{calling a private constructor of class 'S'}}
615 for (int i = 0; i < 16; ++i)
619 void test_ordered() {
620 #pragma omp target teams distribute parallel for simd ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp target teams distribute parallel for simd'}}
621 for (int i = 0; i < 16; ++i)
626 #pragma omp target teams distribute parallel for simd nowait nowait // expected-error {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'nowait' clause}}
627 for (int i = 0; i < 16; ++i)