1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -verify=expected,omp45,omp45warn %s
2 // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s
3 // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 -Wno-openmp %s
4 // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 -Wno-source-uses-openmp %s
5 
6 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify=expected,omp45,omp45warn %s
7 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s
8 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 
10 void bar();
11 
12 template <class T>
foo()13 void foo() {
14   T a = T();
15 // PARALLEL DIRECTIVE
16 #pragma omp parallel
17 #pragma omp for
18   for (int i = 0; i < 10; ++i)
19     ;
20 #pragma omp parallel
21 #pragma omp simd
22   for (int i = 0; i < 10; ++i)
23     ;
24 #pragma omp parallel
25 #pragma omp for simd
26   for (int i = 0; i < 10; ++i)
27     ;
28 #pragma omp parallel
29 #pragma omp sections
30   {
31     bar();
32   }
33 #pragma omp parallel
34 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel region}}
35   {
36     bar();
37   }
38 #pragma omp parallel
39 #pragma omp single
40   bar();
41 
42 #pragma omp parallel
43 #pragma omp master
44   {
45     bar();
46   }
47 #pragma omp parallel
48 #pragma omp critical
49   {
50     bar();
51   }
52 #pragma omp parallel
53 #pragma omp parallel for
54   for (int i = 0; i < 10; ++i)
55     ;
56 #pragma omp parallel
57 #pragma omp parallel for simd
58   for (int i = 0; i < 10; ++i)
59     ;
60 #pragma omp parallel
61 #pragma omp parallel sections
62   {
63     bar();
64   }
65 #pragma omp parallel
66 #pragma omp parallel master
67   {
68     bar();
69   }
70 #pragma omp parallel
71 #pragma omp task
72   {
73     bar();
74   }
75 #pragma omp parallel
76   {
77 #pragma omp taskyield
78     bar();
79   }
80 #pragma omp parallel
81   {
82 #pragma omp barrier
83     bar();
84   }
85 #pragma omp parallel
86   {
87 #pragma omp taskwait
88     bar();
89   }
90 #pragma omp parallel
91   {
92 #pragma omp flush
93     bar();
94   }
95 #pragma omp parallel
96   {
97 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
98     bar();
99   }
100 #pragma omp parallel
101   {
102 #pragma omp atomic
103     ++a;
104   }
105 #pragma omp parallel
106   {
107 #pragma omp target
108     ++a;
109   }
110 #pragma omp parallel
111   {
112 #pragma omp target parallel
113     ++a;
114   }
115 #pragma omp parallel
116   {
117 #pragma omp target parallel for
118   for (int i = 0; i < 10; ++i)
119     ;
120   }
121 #pragma omp parallel
122   {
123 #pragma omp target enter data map(to: a)
124     ++a;
125   }
126 #pragma omp parallel
127   {
128 #pragma omp target exit data map(from: a)
129     ++a;
130   }
131 #pragma omp parallel
132   {
133 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
134     ++a;
135   }
136 #pragma omp parallel
137   {
138 #pragma omp taskloop
139   for (int i = 0; i < 10; ++i)
140     ++a;
141   }
142 #pragma omp parallel
143   {
144 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
145     for (int i = 0; i < 10; ++i)
146       ;
147   }
148 #pragma omp parallel
149   {
150 #pragma omp target update to(a)
151   }
152 #pragma omp parallel
153   {
154 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
155     for (int i = 0; i < 10; ++i)
156       ;
157   }
158 #pragma omp parallel
159   {
160 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
161     for (int i = 0; i < 10; ++i)
162       ;
163   }
164 #pragma omp parallel
165   {
166 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
167     for (int i = 0; i < 10; ++i)
168       ;
169   }
170 #pragma omp parallel
171   {
172 #pragma omp target simd // OK
173     for (int i = 0; i < 10; ++i)
174       ;
175   }
176 #pragma omp parallel
177   {
178 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
179     for (int i = 0; i < 10; ++i)
180       ;
181   }
182 #pragma omp parallel
183   {
184 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
185     for (int i = 0; i < 10; ++i)
186       ;
187   }
188 #pragma omp parallel
189   {
190 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
191     for (int i = 0; i < 10; ++i)
192       ;
193   }
194 #pragma omp parallel
195   {
196 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
197     for (int i = 0; i < 10; ++i)
198       ;
199   }
200 #pragma omp parallel
201   {
202 #pragma omp target teams // OK
203     ++a;
204   }
205 #pragma omp parallel
206   {
207 #pragma omp target teams distribute // OK
208     for (int i = 0; i < 10; ++i)
209       ;
210   }
211 #pragma omp parallel
212   {
213 #pragma omp target teams distribute parallel for // OK
214     for (int i = 0; i < 10; ++i)
215       ;
216   }
217 #pragma omp parallel
218   {
219 #pragma omp target teams distribute parallel for simd // OK
220     for (int i = 0; i < 10; ++i)
221       ;
222   }
223 #pragma omp parallel
224   {
225 #pragma omp target teams distribute simd // OK
226     for (int i = 0; i < 10; ++i)
227       ;
228   }
229 
230 // SIMD DIRECTIVE
231 #pragma omp simd
232   for (int i = 0; i < 10; ++i) {
233 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
234     for (int i = 0; i < 10; ++i)
235       ;
236   }
237 #pragma omp simd
238   for (int i = 0; i < 10; ++i) {
239 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
240     for (int i = 0; i < 10; ++i)
241       ;
242   }
243 #pragma omp simd
244   for (int i = 0; i < 10; ++i) {
245 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
246     for (int i = 0; i < 10; ++i)
247       ;
248   }
249 #pragma omp simd
250   for (int i = 0; i < 10; ++i) {
251 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
252     for (int i = 0; i < 10; ++i)
253       ;
254   }
255 #pragma omp simd
256   for (int i = 0; i < 10; ++i) {
257 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
258     {
259       bar();
260     }
261   }
262 #pragma omp simd
263   for (int i = 0; i < 10; ++i) {
264 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
265     {
266       bar();
267     }
268   }
269 #pragma omp simd
270   for (int i = 0; i < 10; ++i) {
271 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
272     {
273       bar();
274     }
275   }
276 #pragma omp simd
277   for (int i = 0; i < 10; ++i) {
278 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
279     {
280       bar();
281     }
282   }
283 #pragma omp simd
284   for (int i = 0; i < 10; ++i) {
285 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
286     {
287       bar();
288     }
289   }
290 #pragma omp simd
291   for (int i = 0; i < 10; ++i) {
292 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
293     for (int i = 0; i < 10; ++i)
294       ;
295   }
296 #pragma omp simd
297   for (int i = 0; i < 10; ++i) {
298 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
299     for (int i = 0; i < 10; ++i)
300       ;
301   }
302 #pragma omp simd
303   for (int i = 0; i < 10; ++i) {
304 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
305     {
306       bar();
307     }
308   }
309 #pragma omp simd
310   for (int i = 0; i < 10; ++i) {
311 #pragma omp parallel master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
312     {
313       bar();
314     }
315   }
316 #pragma omp simd
317   for (int i = 0; i < 10; ++i) {
318 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
319     {
320       bar();
321     }
322   }
323 #pragma omp simd
324   for (int i = 0; i < 10; ++i) {
325 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
326     bar();
327   }
328 #pragma omp simd
329   for (int i = 0; i < 10; ++i) {
330 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
331     bar();
332   }
333 #pragma omp simd
334   for (int i = 0; i < 10; ++i) {
335 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
336     bar();
337   }
338 #pragma omp simd
339   for (int i = 0; i < 10; ++i) {
340 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
341     bar();
342   }
343 #pragma omp simd
344   for (int i = 0; i < 10; ++i) {
345 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
346     bar();
347   }
348 #pragma omp simd
349   for (int i = 0; i < 10; ++i) {
350 #pragma omp ordered simd // OK
351     bar();
352   }
353 #pragma omp simd
354   for (int i = 0; i < 10; ++i) {
355 #pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
356     bar();
357   }
358 #pragma omp simd
359   for (int i = 0; i < 10; ++i) {
360 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
361     ++a;
362   }
363 #pragma omp simd
364   for (int i = 0; i < 10; ++i) {
365 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
366     ++a;
367   }
368 #pragma omp simd
369   for (int i = 0; i < 10; ++i) {
370 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
371     ++a;
372   }
373 #pragma omp simd
374   for (int i = 0; i < 10; ++i) {
375 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
376     for (int i = 0; i < 10; ++i)
377       ;
378   }
379 #pragma omp simd
380   for (int i = 0; i < 10; ++i) {
381 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
382     ++a;
383   }
384 #pragma omp simd
385   for (int i = 0; i < 10; ++i) {
386 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
387     ++a;
388   }
389 #pragma omp simd
390   for (int i = 0; i < 10; ++i) {
391 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
392     ++a;
393   }
394 #pragma omp simd
395   for (int i = 0; i < 10; ++i) {
396 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
397   for (int i = 0; i < 10; ++i)
398     ++a;
399   }
400 #pragma omp simd
401   for (int i = 0; i < 10; ++i) {
402 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
403     for (int j = 0; j < 10; ++j)
404       ;
405   }
406 #pragma omp simd
407   for (int i = 0; i < 10; ++i) {
408 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
409   }
410 #pragma omp simd
411   for (int i = 0; i < 10; ++i) {
412 #pragma omp distribute parallel for// expected-error {{OpenMP constructs may not be nested inside a simd region}}
413     for (int j = 0; j < 10; ++j)
414       ;
415   }
416 #pragma omp simd
417   for (int i = 0; i < 10; ++i) {
418 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
419     for (int j = 0; j < 10; ++j)
420       ;
421   }
422 #pragma omp simd
423   for (int i = 0; i < 10; ++i) {
424 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
425     for (int j = 0; j < 10; ++j)
426       ;
427   }
428 #pragma omp simd
429   for (int i = 0; i < 10; ++i) {
430 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
431     for (int j = 0; j < 10; ++j)
432       ;
433   }
434 #pragma omp simd
435   for (int i = 0; i < 10; ++i) {
436 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
437     for (int j = 0; j < 10; ++j)
438       ;
439   }
440 #pragma omp simd
441   for (int i = 0; i < 10; ++i) {
442 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
443     for (int j = 0; j < 10; ++j)
444       ;
445   }
446 #pragma omp simd
447   for (int i = 0; i < 10; ++i) {
448 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
449     for (int j = 0; j < 10; ++j)
450       ;
451   }
452 #pragma omp simd
453   for (int i = 0; i < 10; ++i) {
454 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
455     for (int j = 0; j < 10; ++j)
456       ;
457   }
458 #pragma omp simd
459   for (int i = 0; i < 10; ++i) {
460 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
461     ++a;
462   }
463 #pragma omp simd
464   for (int i = 0; i < 10; ++i) {
465 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
466     for (int j = 0; j < 10; ++j)
467       ;
468   }
469 #pragma omp simd
470   for (int i = 0; i < 10; ++i) {
471 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
472     for (int j = 0; j < 10; ++j)
473       ;
474   }
475 #pragma omp simd
476   for (int i = 0; i < 10; ++i) {
477 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
478     for (int j = 0; j < 10; ++j)
479       ;
480   }
481 #pragma omp simd
482   for (int i = 0; i < 10; ++i) {
483 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
484     for (int j = 0; j < 10; ++j)
485       ;
486   }
487 
488 // FOR DIRECTIVE
489 #pragma omp for
490   for (int i = 0; i < 10; ++i) {
491 #pragma omp for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
492     for (int i = 0; i < 10; ++i)
493       ;
494   }
495 #pragma omp for
496   for (int i = 0; i < 10; ++i) {
497 #pragma omp simd
498     for (int i = 0; i < 10; ++i)
499       ;
500   }
501 #pragma omp for
502   for (int i = 0; i < 10; ++i) {
503 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
504     for (int i = 0; i < 10; ++i)
505       ;
506   }
507 #pragma omp for
508   for (int i = 0; i < 10; ++i) {
509 #pragma omp parallel
510     for (int i = 0; i < 10; ++i)
511       ;
512   }
513 #pragma omp for
514   for (int i = 0; i < 10; ++i) {
515 #pragma omp sections // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
516     {
517       bar();
518     }
519   }
520 #pragma omp for
521   for (int i = 0; i < 10; ++i) {
522 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a for region}}
523     {
524       bar();
525     }
526   }
527 #pragma omp for
528   for (int i = 0; i < 10; ++i) {
529 #pragma omp single // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
530     {
531       bar();
532     }
533   }
534 
535 #pragma omp for
536   for (int i = 0; i < 10; ++i) {
537 #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
538     {
539       bar();
540     }
541   }
542 #pragma omp for
543   for (int i = 0; i < 10; ++i) {
544 #pragma omp critical
545     {
546       bar();
547     }
548   }
549 #pragma omp for
550   for (int i = 0; i < 10; ++i) {
551 #pragma omp parallel
552     {
553 #pragma omp single // OK
554       {
555         bar();
556       }
557 #pragma omp for // OK
558       for (int i = 0; i < 10; ++i)
559         ;
560 #pragma omp sections // OK
561       {
562         bar();
563       }
564     }
565   }
566 #pragma omp for
567   for (int i = 0; i < 10; ++i) {
568 #pragma omp parallel for
569     for (int i = 0; i < 10; ++i)
570       ;
571   }
572 #pragma omp for
573   for (int i = 0; i < 10; ++i) {
574 #pragma omp parallel for simd
575     for (int i = 0; i < 10; ++i)
576       ;
577   }
578 #pragma omp for
579   for (int i = 0; i < 10; ++i) {
580 #pragma omp parallel master
581     {
582       bar();
583     }
584   }
585 #pragma omp for
586   for (int i = 0; i < 10; ++i) {
587 #pragma omp parallel sections
588     {
589       bar();
590     }
591   }
592 #pragma omp for
593   for (int i = 0; i < 10; ++i) {
594 #pragma omp task
595     {
596       bar();
597     }
598   }
599 #pragma omp for
600   for (int i = 0; i < 10; ++i) {
601 #pragma omp taskyield
602     bar();
603   }
604 #pragma omp for
605   for (int i = 0; i < 10; ++i) {
606 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}}
607     bar();
608   }
609 #pragma omp for
610   for (int i = 0; i < 10; ++i) {
611 #pragma omp taskwait
612     bar();
613   }
614 #pragma omp for
615   for (int i = 0; i < 10; ++i) {
616 #pragma omp flush
617     bar();
618   }
619 #pragma omp for
620   for (int i = 0; i < 10; ++i) {
621 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
622     bar();
623   }
624 #pragma omp for ordered
625   for (int i = 0; i < 10; ++i) {
626 #pragma omp ordered // OK
627     bar();
628   }
629 #pragma omp for
630   for (int i = 0; i < 10; ++i) {
631 #pragma omp atomic
632     ++a;
633   }
634 #pragma omp for
635   for (int i = 0; i < 10; ++i) {
636 #pragma omp target
637     ++a;
638   }
639 #pragma omp for
640   for (int i = 0; i < 10; ++i) {
641 #pragma omp target parallel
642     ++a;
643   }
644 #pragma omp for
645   for (int i = 0; i < 10; ++i) {
646 #pragma omp target parallel for
647     for (int i = 0; i < 10; ++i)
648       ;
649   }
650 #pragma omp for
651   for (int i = 0; i < 10; ++i) {
652 #pragma omp target enter data map(to: a)
653     ++a;
654   }
655 #pragma omp for
656   for (int i = 0; i < 10; ++i) {
657 #pragma omp target exit data map(from: a)
658     ++a;
659   }
660 #pragma omp for
661   for (int i = 0; i < 10; ++i) {
662 #pragma omp teams // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
663     ++a;
664   }
665 #pragma omp for
666   for (int i = 0; i < 10; ++i) {
667 #pragma omp taskloop
668   for (int i = 0; i < 10; ++i)
669     ++a;
670   }
671 #pragma omp for
672   for (int i = 0; i < 10; ++i) {
673 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
674     for (int j = 0; j < 10; ++j)
675       ;
676   }
677 #pragma omp for
678   for (int i = 0; i < 10; ++i) {
679 #pragma omp target update to(a)
680   }
681 #pragma omp for
682   for (int i = 0; i < 10; ++i) {
683 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
684     for (int j = 0; j < 10; ++j)
685       ;
686   }
687 #pragma omp for
688   for (int i = 0; i < 10; ++i) {
689 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
690     for (int j = 0; j < 10; ++j)
691       ;
692   }
693 #pragma omp for
694   for (int i = 0; i < 10; ++i) {
695 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
696     for (int j = 0; j < 10; ++j)
697       ;
698   }
699 #pragma omp for
700   for (int i = 0; i < 10; ++i) {
701 #pragma omp target simd // OK
702     for (int j = 0; j < 10; ++j)
703       ;
704   }
705 #pragma omp for
706   for (int i = 0; i < 10; ++i) {
707 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
708     for (int j = 0; j < 10; ++j)
709       ;
710   }
711 #pragma omp for
712   for (int i = 0; i < 10; ++i) {
713 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
714     for (int j = 0; j < 10; ++j)
715       ;
716   }
717 #pragma omp for
718   for (int i = 0; i < 10; ++i) {
719 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
720     for (int j = 0; j < 10; ++j)
721       ;
722   }
723 #pragma omp for
724   for (int i = 0; i < 10; ++i) {
725 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
726     for (int j = 0; j < 10; ++j)
727       ;
728   }
729 #pragma omp for
730   for (int i = 0; i < 10; ++i) {
731 #pragma omp target teams // OK
732     ++a;
733   }
734 #pragma omp for
735   for (int i = 0; i < 10; ++i) {
736 #pragma omp target teams distribute // OK
737     for (int j = 0; j < 10; ++j)
738       ;
739   }
740 #pragma omp for
741   for (int i = 0; i < 10; ++i) {
742 #pragma omp target teams distribute parallel for // OK
743     for (int j = 0; j < 10; ++j)
744       ;
745   }
746 #pragma omp for
747   for (int i = 0; i < 10; ++i) {
748 #pragma omp target teams distribute parallel for simd // OK
749     for (int j = 0; j < 10; ++j)
750       ;
751   }
752 #pragma omp for
753   for (int i = 0; i < 10; ++i) {
754 #pragma omp target teams distribute simd // OK
755     for (int j = 0; j < 10; ++j)
756       ;
757   }
758 
759 // FOR SIMD DIRECTIVE
760 #pragma omp for simd
761   for (int i = 0; i < 10; ++i) {
762 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
763     for (int i = 0; i < 10; ++i)
764       ;
765   }
766 #pragma omp for simd
767   for (int i = 0; i < 10; ++i) {
768 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
769     for (int i = 0; i < 10; ++i)
770       ;
771   }
772 #pragma omp for simd
773   for (int i = 0; i < 10; ++i) {
774 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
775     for (int i = 0; i < 10; ++i)
776       ;
777   }
778 #pragma omp for simd
779   for (int i = 0; i < 10; ++i) {
780 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
781     for (int i = 0; i < 10; ++i)
782       ;
783   }
784 #pragma omp for simd
785   for (int i = 0; i < 10; ++i) {
786 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
787     {
788       bar();
789     }
790   }
791 #pragma omp for simd
792   for (int i = 0; i < 10; ++i) {
793 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
794     {
795       bar();
796     }
797   }
798 #pragma omp for simd
799   for (int i = 0; i < 10; ++i) {
800 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
801     {
802       bar();
803     }
804   }
805 #pragma omp for simd
806   for (int i = 0; i < 10; ++i) {
807 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
808     {
809       bar();
810     }
811   }
812 #pragma omp for simd
813   for (int i = 0; i < 10; ++i) {
814 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
815     {
816       bar();
817     }
818   }
819 #pragma omp for simd
820   for (int i = 0; i < 10; ++i) {
821 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
822     for (int i = 0; i < 10; ++i)
823       ;
824   }
825 #pragma omp for simd
826   for (int i = 0; i < 10; ++i) {
827 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
828     for (int i = 0; i < 10; ++i)
829       ;
830   }
831 #pragma omp for simd
832   for (int i = 0; i < 10; ++i) {
833 #pragma omp parallel master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
834     {
835       bar();
836     }
837   }
838 #pragma omp for simd
839   for (int i = 0; i < 10; ++i) {
840 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
841     {
842       bar();
843     }
844   }
845 #pragma omp for simd
846   for (int i = 0; i < 10; ++i) {
847 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
848     {
849       bar();
850     }
851   }
852 #pragma omp for simd
853   for (int i = 0; i < 10; ++i) {
854 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
855     bar();
856   }
857 #pragma omp for simd
858   for (int i = 0; i < 10; ++i) {
859 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
860     bar();
861   }
862 #pragma omp for simd
863   for (int i = 0; i < 10; ++i) {
864 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
865     bar();
866   }
867 #pragma omp for simd
868   for (int i = 0; i < 10; ++i) {
869 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
870     bar();
871   }
872 #pragma omp for simd
873   for (int i = 0; i < 10; ++i) {
874 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
875     bar();
876   }
877 #pragma omp for simd
878   for (int i = 0; i < 10; ++i) {
879 #pragma omp ordered simd // OK
880     bar();
881   }
882 #pragma omp for simd
883   for (int i = 0; i < 10; ++i) {
884 #pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
885     bar();
886   }
887 #pragma omp for simd
888   for (int i = 0; i < 10; ++i) {
889 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
890     ++a;
891   }
892 #pragma omp for simd
893   for (int i = 0; i < 10; ++i) {
894 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
895     ++a;
896   }
897 #pragma omp for simd
898   for (int i = 0; i < 10; ++i) {
899 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
900     ++a;
901   }
902 #pragma omp for simd
903   for (int i = 0; i < 10; ++i) {
904 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
905     for (int i = 0; i < 10; ++i)
906       ;
907   }
908 #pragma omp for simd
909   for (int i = 0; i < 10; ++i) {
910 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
911     ++a;
912   }
913 #pragma omp for simd
914   for (int i = 0; i < 10; ++i) {
915 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
916     ++a;
917   }
918 #pragma omp for simd
919   for (int i = 0; i < 10; ++i) {
920 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
921     ++a;
922   }
923 #pragma omp for simd
924   for (int i = 0; i < 10; ++i) {
925 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
926   for (int i = 0; i < 10; ++i)
927     ++a;
928   }
929 #pragma omp for simd
930   for (int i = 0; i < 10; ++i) {
931 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
932     for (int j = 0; j < 10; ++j)
933       ;
934   }
935 #pragma omp for simd
936   for (int i = 0; i < 10; ++i) {
937 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
938     bar();
939   }
940 #pragma omp for simd
941   for (int i = 0; i < 10; ++i) {
942 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
943     for (int j = 0; j < 10; ++j)
944       ;
945   }
946 #pragma omp for simd
947   for (int i = 0; i < 10; ++i) {
948 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
949     for (int j = 0; j < 10; ++j)
950       ;
951   }
952 #pragma omp for simd
953   for (int i = 0; i < 10; ++i) {
954 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
955     for (int j = 0; j < 10; ++j)
956       ;
957   }
958 #pragma omp for simd
959   for (int i = 0; i < 10; ++i) {
960 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
961     for (int j = 0; j < 10; ++j)
962       ;
963   }
964 #pragma omp for simd
965   for (int i = 0; i < 10; ++i) {
966 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
967     for (int j = 0; j < 10; ++j)
968       ;
969   }
970 #pragma omp for simd
971   for (int i = 0; i < 10; ++i) {
972 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
973     for (int j = 0; j < 10; ++j)
974       ;
975   }
976 #pragma omp for simd
977   for (int i = 0; i < 10; ++i) {
978 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
979     for (int j = 0; j < 10; ++j)
980       ;
981   }
982 #pragma omp for simd
983   for (int i = 0; i < 10; ++i) {
984 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
985     for (int j = 0; j < 10; ++j)
986       ;
987   }
988 #pragma omp for simd
989   for (int i = 0; i < 10; ++i) {
990 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
991     a++;
992   }
993 #pragma omp for simd
994   for (int i = 0; i < 10; ++i) {
995 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
996     for (int j = 0; j < 10; ++j)
997       ;
998   }
999 #pragma omp for simd
1000   for (int i = 0; i < 10; ++i) {
1001 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1002     for (int j = 0; j < 10; ++j)
1003       ;
1004   }
1005 #pragma omp for simd
1006   for (int i = 0; i < 10; ++i) {
1007 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1008     for (int j = 0; j < 10; ++j)
1009       ;
1010   }
1011 #pragma omp for simd
1012   for (int i = 0; i < 10; ++i) {
1013 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
1014     for (int j = 0; j < 10; ++j)
1015       ;
1016   }
1017 
1018 // SECTIONS DIRECTIVE
1019 #pragma omp sections
1020   {
1021 #pragma omp for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1022     for (int i = 0; i < 10; ++i)
1023       ;
1024   }
1025 #pragma omp sections
1026   {
1027 #pragma omp simd
1028     for (int i = 0; i < 10; ++i)
1029       ;
1030   }
1031 #pragma omp sections
1032   {
1033 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1034     for (int i = 0; i < 10; ++i)
1035       ;
1036   }
1037 #pragma omp sections
1038   {
1039 #pragma omp parallel
1040     for (int i = 0; i < 10; ++i)
1041       ;
1042   }
1043 #pragma omp sections
1044   {
1045 #pragma omp sections // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1046     {
1047       bar();
1048     }
1049   }
1050 #pragma omp sections
1051   {
1052 #pragma omp section
1053     {
1054       bar();
1055     }
1056   }
1057 #pragma omp sections
1058   {
1059 #pragma omp parallel
1060     {
1061 #pragma omp single // OK
1062       {
1063         bar();
1064       }
1065 #pragma omp for // OK
1066       for (int i = 0; i < 10; ++i)
1067         ;
1068 #pragma omp sections // OK
1069       {
1070         bar();
1071       }
1072     }
1073   }
1074 #pragma omp sections
1075   {
1076 #pragma omp parallel master
1077     {
1078       bar();
1079     }
1080   }
1081 #pragma omp sections
1082   {
1083 #pragma omp parallel
1084     {
1085 #pragma omp master // OK
1086       {
1087         bar();
1088       }
1089 #pragma omp for // OK
1090       for (int i = 0; i < 10; ++i)
1091         ;
1092 #pragma omp master // OK
1093       {
1094         bar();
1095       }
1096     }
1097 #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}}
1098     bar();
1099   }
1100 #pragma omp sections
1101   {
1102 #pragma omp parallel
1103     {
1104 #pragma omp critical(A) // OK
1105       {
1106         bar();
1107       }
1108 #pragma omp for // OK
1109       for (int i = 0; i < 10; ++i)
1110         ;
1111 #pragma omp critical // OK
1112       {
1113         bar();
1114       }
1115     }
1116 #pragma omp critical(A) // expected-error {{statement in 'omp sections' directive must be enclosed into a section region}}
1117     bar();
1118   }
1119 #pragma omp sections
1120   {
1121 #pragma omp parallel for
1122     for (int i = 0; i < 10; ++i)
1123       ;
1124   }
1125 #pragma omp sections
1126   {
1127 #pragma omp parallel for simd
1128     for (int i = 0; i < 10; ++i)
1129       ;
1130   }
1131 #pragma omp sections
1132   {
1133 #pragma omp parallel sections
1134     {
1135       bar();
1136     }
1137   }
1138 #pragma omp sections
1139   {
1140 #pragma omp task
1141     {
1142       bar();
1143     }
1144   }
1145 #pragma omp sections
1146   {
1147 #pragma omp taskyield
1148   }
1149 #pragma omp sections
1150   {
1151 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}}
1152   }
1153 #pragma omp sections
1154   {
1155 #pragma omp taskwait
1156   }
1157 #pragma omp sections
1158   {
1159 #pragma omp flush
1160   }
1161 #pragma omp sections
1162   {
1163 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1164     bar();
1165   }
1166 #pragma omp sections
1167   {
1168 #pragma omp atomic
1169     ++a;
1170   }
1171 #pragma omp sections
1172   {
1173 #pragma omp target
1174     ++a;
1175   }
1176 #pragma omp sections
1177   {
1178 #pragma omp target parallel
1179     ++a;
1180   }
1181 #pragma omp sections
1182   {
1183 #pragma omp target parallel for
1184     for (int i = 0; i < 10; ++i)
1185       ;
1186   }
1187 #pragma omp sections
1188   {
1189 #pragma omp target enter data map(to: a)
1190   }
1191 #pragma omp sections
1192   {
1193 #pragma omp target exit data map(from: a)
1194   }
1195 #pragma omp sections
1196   {
1197 #pragma omp teams // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1198     ++a;
1199   }
1200 #pragma omp sections
1201   {
1202 #pragma omp taskloop
1203   for (int i = 0; i < 10; ++i)
1204     ++a;
1205   }
1206 #pragma omp sections
1207   {
1208 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
1209     for (int i = 0; i < 10; ++i)
1210       ;
1211   }
1212 #pragma omp sections
1213   {
1214 #pragma omp target update to(a)
1215   }
1216 #pragma omp sections
1217   {
1218 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
1219     for (int i = 0; i < 10; ++i)
1220       ;
1221   }
1222 #pragma omp sections
1223   {
1224 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
1225     for (int i = 0; i < 10; ++i)
1226       ;
1227   }
1228 #pragma omp sections
1229   {
1230 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
1231     for (int i = 0; i < 10; ++i)
1232       ;
1233   }
1234 #pragma omp sections
1235   {
1236 #pragma omp target simd // OK
1237     for (int i = 0; i < 10; ++i)
1238       ;
1239   }
1240 #pragma omp sections
1241   {
1242 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
1243     for (int i = 0; i < 10; ++i)
1244       ;
1245   }
1246 #pragma omp sections
1247   {
1248 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
1249     for (int i = 0; i < 10; ++i)
1250       ;
1251   }
1252 #pragma omp sections
1253   {
1254 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
1255     for (int i = 0; i < 10; ++i)
1256       ;
1257   }
1258 #pragma omp sections
1259   {
1260 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
1261     for (int i = 0; i < 10; ++i)
1262       ;
1263   }
1264 #pragma omp sections
1265   {
1266 #pragma omp target teams // OK
1267     ++a;
1268   }
1269 #pragma omp sections
1270   {
1271 #pragma omp target teams distribute // OK
1272     for (int i = 0; i < 10; ++i)
1273       ;
1274   }
1275 #pragma omp sections
1276   {
1277 #pragma omp target teams distribute parallel for // OK
1278     for (int i = 0; i < 10; ++i)
1279       ;
1280   }
1281 #pragma omp sections
1282   {
1283 #pragma omp target teams distribute parallel for simd // OK
1284     for (int i = 0; i < 10; ++i)
1285       ;
1286   }
1287 #pragma omp sections
1288   {
1289 #pragma omp target teams distribute simd // OK
1290     for (int i = 0; i < 10; ++i)
1291       ;
1292   }
1293 
1294 // SECTION DIRECTIVE
1295 #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
1296   {
1297     bar();
1298   }
1299 #pragma omp sections
1300   {
1301 #pragma omp section
1302     {
1303 #pragma omp for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1304       for (int i = 0; i < 10; ++i)
1305         ;
1306     }
1307   }
1308 #pragma omp sections
1309   {
1310 #pragma omp section
1311     {
1312 #pragma omp simd
1313       for (int i = 0; i < 10; ++i)
1314         ;
1315     }
1316   }
1317 #pragma omp sections
1318   {
1319 #pragma omp section
1320     {
1321 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1322       for (int i = 0; i < 10; ++i)
1323         ;
1324     }
1325   }
1326 #pragma omp sections
1327   {
1328 #pragma omp section
1329     {
1330 #pragma omp parallel
1331       for (int i = 0; i < 10; ++i)
1332         ;
1333     }
1334   }
1335 #pragma omp sections
1336   {
1337 #pragma omp section
1338     {
1339 #pragma omp sections // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1340       {
1341         bar();
1342       }
1343     }
1344   }
1345 #pragma omp sections
1346   {
1347 #pragma omp section
1348     {
1349 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a section region}}
1350       {
1351         bar();
1352       }
1353     }
1354   }
1355 #pragma omp sections
1356   {
1357 #pragma omp section
1358     {
1359 #pragma omp parallel master
1360       bar();
1361 #pragma omp critical
1362       bar();
1363     }
1364   }
1365 #pragma omp sections
1366   {
1367 #pragma omp section
1368     {
1369 #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1370       bar();
1371 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
1372       bar();
1373 #pragma omp critical
1374       bar();
1375     }
1376   }
1377 #pragma omp sections
1378   {
1379 #pragma omp section
1380     {
1381 #pragma omp parallel
1382       {
1383 #pragma omp single // OK
1384         {
1385           bar();
1386         }
1387 #pragma omp for // OK
1388         for (int i = 0; i < 10; ++i)
1389           ;
1390 #pragma omp for simd // OK
1391         for (int i = 0; i < 10; ++i)
1392           ;
1393 #pragma omp sections // OK
1394         {
1395           bar();
1396         }
1397       }
1398     }
1399   }
1400 #pragma omp sections
1401   {
1402 #pragma omp section
1403     {
1404 #pragma omp parallel for
1405       for (int i = 0; i < 10; ++i)
1406         ;
1407     }
1408   }
1409 #pragma omp sections
1410   {
1411 #pragma omp section
1412     {
1413 #pragma omp parallel for simd
1414       for (int i = 0; i < 10; ++i)
1415         ;
1416     }
1417   }
1418 #pragma omp sections
1419   {
1420 #pragma omp section
1421     {
1422 #pragma omp parallel sections
1423       {
1424         bar();
1425       }
1426     }
1427   }
1428 #pragma omp sections
1429   {
1430 #pragma omp section
1431     {
1432 #pragma omp task
1433       {
1434         bar();
1435       }
1436     }
1437   }
1438 #pragma omp sections
1439   {
1440 #pragma omp section
1441     {
1442 #pragma omp taskyield
1443       bar();
1444     }
1445   }
1446 #pragma omp sections
1447   {
1448 #pragma omp section
1449     {
1450 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'section' region}}
1451       bar();
1452     }
1453   }
1454 #pragma omp sections
1455   {
1456 #pragma omp section
1457     {
1458 #pragma omp taskwait
1459       bar();
1460     }
1461   }
1462 #pragma omp sections
1463   {
1464 #pragma omp section
1465     {
1466 #pragma omp flush
1467       bar();
1468     }
1469   }
1470 #pragma omp sections
1471   {
1472 #pragma omp section
1473     {
1474 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1475       bar();
1476     }
1477   }
1478 #pragma omp sections
1479   {
1480 #pragma omp section
1481 #pragma omp atomic
1482     ++a;
1483   }
1484 #pragma omp sections
1485   {
1486 #pragma omp section
1487 #pragma omp target
1488     ++a;
1489   }
1490 #pragma omp sections
1491   {
1492 #pragma omp section
1493 #pragma omp target parallel
1494     ++a;
1495   }
1496 #pragma omp sections
1497   {
1498 #pragma omp section
1499     {
1500 #pragma omp target parallel for
1501       for (int i = 0; i < 10; ++i)
1502         ;
1503     }
1504   }
1505 #pragma omp sections
1506   {
1507 #pragma omp section
1508     {
1509 #pragma omp target enter data map(to: a)
1510       ++a;
1511     }
1512   }
1513 #pragma omp sections
1514   {
1515 #pragma omp section
1516     {
1517 #pragma omp target exit data map(from: a)
1518       ++a;
1519     }
1520   }
1521 #pragma omp sections
1522   {
1523 #pragma omp section
1524 #pragma omp teams // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1525     ++a;
1526   }
1527 #pragma omp sections
1528   {
1529 #pragma omp section
1530 #pragma omp taskloop
1531   for (int i = 0; i < 10; ++i)
1532     ++a;
1533   }
1534 #pragma omp sections
1535   {
1536 #pragma omp section
1537 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
1538     for (int i = 0; i < 10; ++i)
1539       ;
1540   }
1541 #pragma omp sections
1542   {
1543 #pragma omp section
1544     {
1545       bar();
1546 #pragma omp target update to(a)
1547     }
1548   }
1549 #pragma omp sections
1550   {
1551 #pragma omp section
1552 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
1553     for (int i = 0; i < 10; ++i)
1554       ;
1555   }
1556 #pragma omp sections
1557   {
1558 #pragma omp section
1559 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
1560     for (int i = 0; i < 10; ++i)
1561       ;
1562   }
1563 #pragma omp sections
1564   {
1565 #pragma omp section
1566 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
1567     for (int i = 0; i < 10; ++i)
1568       ;
1569   }
1570 #pragma omp sections
1571   {
1572 #pragma omp section
1573 #pragma omp target simd // OK
1574     for (int i = 0; i < 10; ++i)
1575       ;
1576   }
1577 #pragma omp sections
1578   {
1579 #pragma omp section
1580 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
1581     for (int i = 0; i < 10; ++i)
1582       ;
1583   }
1584 #pragma omp sections
1585   {
1586 #pragma omp section
1587 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
1588     for (int i = 0; i < 10; ++i)
1589       ;
1590   }
1591 #pragma omp sections
1592   {
1593 #pragma omp section
1594 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
1595     for (int i = 0; i < 10; ++i)
1596       ;
1597   }
1598 #pragma omp sections
1599   {
1600 #pragma omp section
1601 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
1602     for (int i = 0; i < 10; ++i)
1603       ;
1604   }
1605 #pragma omp sections
1606   {
1607 #pragma omp section
1608 #pragma omp target teams // OK
1609     ++a;
1610   }
1611 #pragma omp sections
1612   {
1613 #pragma omp section
1614 #pragma omp target teams distribute // OK
1615     for (int i = 0; i < 10; ++i)
1616       ;
1617   }
1618 #pragma omp sections
1619   {
1620 #pragma omp section
1621 #pragma omp target teams distribute parallel for // OK
1622     for (int i = 0; i < 10; ++i)
1623       ;
1624   }
1625 #pragma omp sections
1626   {
1627 #pragma omp section
1628 #pragma omp target teams distribute parallel for simd // OK
1629     for (int i = 0; i < 10; ++i)
1630       ;
1631   }
1632 #pragma omp sections
1633   {
1634 #pragma omp section
1635 #pragma omp target teams distribute simd // OK
1636     for (int i = 0; i < 10; ++i)
1637       ;
1638   }
1639 
1640 // SINGLE DIRECTIVE
1641 #pragma omp single
1642   {
1643 #pragma omp for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1644     for (int i = 0; i < 10; ++i)
1645       ;
1646   }
1647 #pragma omp single
1648   {
1649 #pragma omp simd
1650     for (int i = 0; i < 10; ++i)
1651       ;
1652   }
1653 #pragma omp single
1654   {
1655 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1656     for (int i = 0; i < 10; ++i)
1657       ;
1658   }
1659 #pragma omp single
1660   {
1661 #pragma omp parallel
1662     for (int i = 0; i < 10; ++i)
1663       ;
1664   }
1665 #pragma omp single
1666   {
1667 #pragma omp single // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1668     {
1669       bar();
1670     }
1671   }
1672 #pragma omp single
1673   {
1674 #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}}
1675     {
1676       bar();
1677     }
1678   }
1679 #pragma omp single
1680   {
1681 #pragma omp parallel master
1682     {
1683       bar();
1684     }
1685   }
1686 #pragma omp single
1687   {
1688 #pragma omp critical
1689     {
1690       bar();
1691     }
1692   }
1693 #pragma omp single
1694   {
1695 #pragma omp sections // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1696     {
1697       bar();
1698     }
1699   }
1700 #pragma omp single
1701   {
1702 #pragma omp parallel
1703     {
1704 #pragma omp single // OK
1705       {
1706         bar();
1707       }
1708 #pragma omp for // OK
1709       for (int i = 0; i < 10; ++i)
1710         ;
1711 #pragma omp for simd // OK
1712       for (int i = 0; i < 10; ++i)
1713         ;
1714 #pragma omp sections // OK
1715       {
1716         bar();
1717       }
1718     }
1719   }
1720 #pragma omp single
1721   {
1722 #pragma omp parallel for
1723     for (int i = 0; i < 10; ++i)
1724       ;
1725   }
1726 #pragma omp single
1727   {
1728 #pragma omp parallel for simd
1729     for (int i = 0; i < 10; ++i)
1730       ;
1731   }
1732 #pragma omp single
1733   {
1734 #pragma omp parallel sections
1735     {
1736       bar();
1737     }
1738   }
1739 #pragma omp single
1740   {
1741 #pragma omp task
1742     {
1743       bar();
1744     }
1745   }
1746 #pragma omp single
1747   {
1748 #pragma omp taskyield
1749     bar();
1750   }
1751 #pragma omp single
1752   {
1753 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}}
1754     bar();
1755   }
1756 #pragma omp single
1757   {
1758 #pragma omp taskwait
1759     bar();
1760   }
1761 #pragma omp single
1762   {
1763 #pragma omp flush
1764     bar();
1765   }
1766 #pragma omp single
1767   {
1768 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
1769     bar();
1770   }
1771 #pragma omp single
1772   {
1773 #pragma omp atomic
1774     ++a;
1775   }
1776 #pragma omp single
1777   {
1778 #pragma omp target
1779     ++a;
1780   }
1781 #pragma omp single
1782   {
1783 #pragma omp target parallel
1784     ++a;
1785   }
1786 #pragma omp single
1787   {
1788 #pragma omp target parallel for
1789     for (int i = 0; i < 10; ++i)
1790       ;
1791   }
1792 #pragma omp single
1793   {
1794 #pragma omp target enter data map(to: a)
1795     ++a;
1796   }
1797 #pragma omp single
1798   {
1799 #pragma omp target exit data map(from: a)
1800     ++a;
1801   }
1802 #pragma omp single
1803   {
1804 #pragma omp teams // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
1805     ++a;
1806   }
1807 #pragma omp single
1808   {
1809 #pragma omp taskloop
1810   for (int i = 0; i < 10; ++i)
1811     ++a;
1812   }
1813 #pragma omp single
1814   {
1815 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
1816     for (int i = 0; i < 10; ++i)
1817       ;
1818   }
1819 #pragma omp single
1820   {
1821 #pragma omp target update to(a)
1822     bar();
1823   }
1824 #pragma omp single
1825   {
1826 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
1827     for (int i = 0; i < 10; ++i)
1828       ;
1829   }
1830 #pragma omp single
1831   {
1832 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
1833     for (int i = 0; i < 10; ++i)
1834       ;
1835   }
1836 #pragma omp single
1837   {
1838 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
1839     for (int i = 0; i < 10; ++i)
1840       ;
1841   }
1842 #pragma omp single
1843   {
1844 #pragma omp target simd // OK
1845     for (int i = 0; i < 10; ++i)
1846       ;
1847   }
1848 #pragma omp single
1849   {
1850 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
1851     for (int i = 0; i < 10; ++i)
1852       ;
1853   }
1854 #pragma omp single
1855   {
1856 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
1857     for (int i = 0; i < 10; ++i)
1858       ;
1859   }
1860 #pragma omp single
1861   {
1862 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
1863     for (int i = 0; i < 10; ++i)
1864       ;
1865   }
1866 #pragma omp single
1867   {
1868 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
1869     for (int i = 0; i < 10; ++i)
1870       ;
1871   }
1872 #pragma omp single
1873   {
1874 #pragma omp target teams // OK
1875     ++a;
1876   }
1877 #pragma omp single
1878   {
1879 #pragma omp target teams distribute // OK
1880     for (int i = 0; i < 10; ++i)
1881       ;
1882   }
1883 #pragma omp single
1884   {
1885 #pragma omp target teams distribute parallel for // OK
1886     for (int i = 0; i < 10; ++i)
1887       ;
1888   }
1889 #pragma omp single
1890   {
1891 #pragma omp target teams distribute parallel for simd // OK
1892     for (int i = 0; i < 10; ++i)
1893       ;
1894   }
1895 #pragma omp single
1896   {
1897 #pragma omp target teams distribute simd // OK
1898     for (int i = 0; i < 10; ++i)
1899       ;
1900   }
1901 
1902 // MASTER DIRECTIVE
1903 #pragma omp master
1904   {
1905 #pragma omp for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
1906     for (int i = 0; i < 10; ++i)
1907       ;
1908   }
1909 #pragma omp master
1910   {
1911 #pragma omp simd
1912     for (int i = 0; i < 10; ++i)
1913       ;
1914   }
1915 #pragma omp master
1916   {
1917 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
1918     for (int i = 0; i < 10; ++i)
1919       ;
1920   }
1921 #pragma omp master
1922   {
1923 #pragma omp parallel
1924     for (int i = 0; i < 10; ++i)
1925       ;
1926   }
1927 #pragma omp master
1928   {
1929 #pragma omp single // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
1930     {
1931       bar();
1932     }
1933   }
1934 #pragma omp master
1935   {
1936 #pragma omp master // OK, though second 'master' is redundant
1937     {
1938       bar();
1939     }
1940   }
1941 #pragma omp master
1942   {
1943 #pragma omp critical
1944     {
1945       bar();
1946     }
1947   }
1948 #pragma omp master
1949   {
1950 #pragma omp sections // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
1951     {
1952       bar();
1953     }
1954   }
1955 #pragma omp master
1956   {
1957 #pragma omp parallel
1958     {
1959 #pragma omp master // OK
1960       {
1961         bar();
1962       }
1963 #pragma omp for // OK
1964       for (int i = 0; i < 10; ++i)
1965         ;
1966 #pragma omp for simd // OK
1967       for (int i = 0; i < 10; ++i)
1968         ;
1969 #pragma omp sections // OK
1970       {
1971         bar();
1972       }
1973     }
1974   }
1975 #pragma omp master
1976   {
1977 #pragma omp parallel master // OK
1978       {
1979         bar();
1980       }
1981 #pragma omp parallel
1982     {
1983 #pragma omp for // OK
1984       for (int i = 0; i < 10; ++i)
1985         ;
1986 #pragma omp for simd // OK
1987       for (int i = 0; i < 10; ++i)
1988         ;
1989 #pragma omp sections // OK
1990       {
1991         bar();
1992       }
1993     }
1994   }
1995 #pragma omp master
1996   {
1997 #pragma omp parallel for
1998     for (int i = 0; i < 10; ++i)
1999       ;
2000   }
2001 #pragma omp master
2002   {
2003 #pragma omp parallel for simd
2004     for (int i = 0; i < 10; ++i)
2005       ;
2006   }
2007 #pragma omp master
2008   {
2009 #pragma omp parallel sections
2010     {
2011       bar();
2012     }
2013   }
2014 #pragma omp master
2015   {
2016 #pragma omp task
2017     {
2018       bar();
2019     }
2020   }
2021 #pragma omp master
2022   {
2023 #pragma omp taskyield
2024     bar();
2025   }
2026 #pragma omp master
2027   {
2028 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}}
2029     bar();
2030   }
2031 #pragma omp master
2032   {
2033 #pragma omp taskwait
2034     bar();
2035   }
2036 #pragma omp master
2037   {
2038 #pragma omp flush
2039     bar();
2040   }
2041 #pragma omp master
2042   {
2043 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
2044     bar();
2045   }
2046 #pragma omp master
2047   {
2048 #pragma omp atomic
2049     ++a;
2050   }
2051 #pragma omp master
2052   {
2053 #pragma omp target
2054     ++a;
2055   }
2056 #pragma omp master
2057   {
2058 #pragma omp target parallel
2059     ++a;
2060   }
2061 #pragma omp master
2062   {
2063 #pragma omp target parallel for
2064     for (int i = 0; i < 10; ++i)
2065       ;
2066   }
2067 #pragma omp master
2068   {
2069 #pragma omp target enter data map(to: a)
2070     ++a;
2071   }
2072 #pragma omp master
2073   {
2074 #pragma omp target exit data map(from: a)
2075     ++a;
2076   }
2077 #pragma omp master
2078   {
2079 #pragma omp teams // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
2080     ++a;
2081   }
2082 #pragma omp master
2083   {
2084 #pragma omp taskloop
2085   for (int i = 0; i < 10; ++i)
2086     ++a;
2087   }
2088 #pragma omp master
2089   {
2090 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
2091     for (int i = 0; i < 10; ++i)
2092       ;
2093   }
2094 #pragma omp master
2095   {
2096 #pragma omp target update to(a)
2097     bar();
2098   }
2099 #pragma omp master
2100   {
2101 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
2102     for (int i = 0; i < 10; ++i)
2103       ;
2104   }
2105 #pragma omp master
2106   {
2107 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
2108     for (int i = 0; i < 10; ++i)
2109       ;
2110   }
2111 #pragma omp master
2112   {
2113 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
2114     for (int i = 0; i < 10; ++i)
2115       ;
2116   }
2117 #pragma omp master
2118   {
2119 #pragma omp target simd // OK
2120     for (int i = 0; i < 10; ++i)
2121       ;
2122   }
2123 #pragma omp master
2124   {
2125 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
2126     for (int i = 0; i < 10; ++i)
2127       ;
2128   }
2129 #pragma omp master
2130   {
2131 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
2132     for (int i = 0; i < 10; ++i)
2133       ;
2134   }
2135 #pragma omp master
2136   {
2137 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
2138     for (int i = 0; i < 10; ++i)
2139       ;
2140   }
2141 #pragma omp master
2142   {
2143 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
2144     for (int i = 0; i < 10; ++i)
2145       ;
2146   }
2147 #pragma omp master
2148   {
2149 #pragma omp target teams // OK
2150     a++;
2151   }
2152 #pragma omp master
2153   {
2154 #pragma omp target teams distribute // OK
2155     for (int i = 0; i < 10; ++i)
2156       ;
2157   }
2158 #pragma omp master
2159   {
2160 #pragma omp target teams distribute parallel for // OK
2161     for (int i = 0; i < 10; ++i)
2162       ;
2163   }
2164 #pragma omp master
2165   {
2166 #pragma omp target teams distribute parallel for simd // OK
2167     for (int i = 0; i < 10; ++i)
2168       ;
2169   }
2170 #pragma omp master
2171   {
2172 #pragma omp target teams distribute simd // OK
2173     for (int i = 0; i < 10; ++i)
2174       ;
2175   }
2176 
2177 // CRITICAL DIRECTIVE
2178 #pragma omp critical
2179   {
2180 #pragma omp for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
2181     for (int i = 0; i < 10; ++i)
2182       ;
2183   }
2184 #pragma omp critical
2185   {
2186 #pragma omp simd
2187     for (int i = 0; i < 10; ++i)
2188       ;
2189   }
2190 #pragma omp critical
2191   {
2192 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
2193     for (int i = 0; i < 10; ++i)
2194       ;
2195   }
2196 #pragma omp critical
2197   {
2198 #pragma omp parallel
2199     for (int i = 0; i < 10; ++i)
2200       ;
2201   }
2202 #pragma omp critical
2203   {
2204 #pragma omp single // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
2205     {
2206       bar();
2207     }
2208   }
2209 #pragma omp critical
2210   {
2211 #pragma omp master // OK, though second 'master' is redundant
2212     {
2213       bar();
2214     }
2215   }
2216 #pragma omp critical
2217   {
2218 #pragma omp critical
2219     {
2220       bar();
2221     }
2222   }
2223 #pragma omp critical
2224   {
2225 #pragma omp sections // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
2226     {
2227       bar();
2228     }
2229   }
2230 #pragma omp critical
2231   {
2232 #pragma omp parallel
2233     {
2234 #pragma omp master // OK
2235       {
2236         bar();
2237       }
2238 #pragma omp for // OK
2239       for (int i = 0; i < 10; ++i)
2240         ;
2241 #pragma omp for simd // OK
2242       for (int i = 0; i < 10; ++i)
2243         ;
2244 #pragma omp sections // OK
2245       {
2246         bar();
2247       }
2248     }
2249   }
2250 #pragma omp critical
2251   {
2252 #pragma omp parallel master
2253     {
2254       bar();
2255     }
2256   }
2257 #pragma omp critical
2258   {
2259 #pragma omp parallel for
2260     for (int i = 0; i < 10; ++i)
2261       ;
2262   }
2263 #pragma omp critical
2264   {
2265 #pragma omp parallel for simd
2266     for (int i = 0; i < 10; ++i)
2267       ;
2268   }
2269 #pragma omp critical
2270   {
2271 #pragma omp parallel sections
2272     {
2273       bar();
2274     }
2275   }
2276 #pragma omp critical
2277   {
2278 #pragma omp task
2279     {
2280       bar();
2281     }
2282   }
2283 #pragma omp critical
2284   {
2285 #pragma omp taskyield
2286     bar();
2287   }
2288 #pragma omp critical
2289   {
2290 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'critical' region}}
2291     bar();
2292   }
2293 #pragma omp critical
2294   {
2295 #pragma omp taskwait
2296     bar();
2297   }
2298 #pragma omp critical(Tuzik)
2299   {
2300 #pragma omp critical(grelka)
2301     bar();
2302   }
2303 #pragma omp critical(Belka) // expected-note {{previous 'critical' region starts here}}
2304   {
2305 #pragma omp critical(Belka) // expected-error {{cannot nest 'critical' regions having the same name 'Belka'}}
2306     {
2307 #pragma omp critical(Tuzik)
2308       {
2309 #pragma omp parallel
2310 #pragma omp critical(grelka)
2311         {
2312           bar();
2313         }
2314       }
2315     }
2316   }
2317 #pragma omp critical
2318   {
2319 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
2320     bar();
2321   }
2322 #pragma omp critical
2323   {
2324 #pragma omp atomic
2325     ++a;
2326   }
2327 #pragma omp critical
2328   {
2329 #pragma omp target
2330     ++a;
2331   }
2332 #pragma omp critical
2333   {
2334 #pragma omp target parallel
2335     ++a;
2336   }
2337 #pragma omp critical
2338   {
2339 #pragma omp target parallel for
2340     for (int i = 0; i < 10; ++i)
2341       ;
2342   }
2343 #pragma omp critical
2344   {
2345 #pragma omp target enter data map(to: a)
2346     ++a;
2347   }
2348 #pragma omp critical
2349   {
2350 #pragma omp target exit data map(from: a)
2351     ++a;
2352   }
2353 #pragma omp critical
2354   {
2355 #pragma omp teams // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
2356     ++a;
2357   }
2358 #pragma omp critical
2359   {
2360 #pragma omp taskloop
2361   for (int i = 0; i < 10; ++i)
2362     ++a;
2363   }
2364 #pragma omp critical
2365   {
2366 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
2367     for (int i = 0; i < 10; ++i)
2368       ;
2369   }
2370 #pragma omp critical
2371   {
2372 #pragma omp target update to(a)
2373     bar();
2374   }
2375 #pragma omp critical
2376   {
2377 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
2378     for (int i = 0; i < 10; ++i)
2379       ;
2380   }
2381 #pragma omp critical
2382   {
2383 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
2384     for (int i = 0; i < 10; ++i)
2385       ;
2386   }
2387 #pragma omp critical
2388   {
2389 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
2390     for (int i = 0; i < 10; ++i)
2391       ;
2392   }
2393 #pragma omp critical
2394   {
2395 #pragma omp target simd // OK
2396     for (int i = 0; i < 10; ++i)
2397       ;
2398   }
2399 #pragma omp critical
2400   {
2401 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
2402     for (int i = 0; i < 10; ++i)
2403       ;
2404   }
2405 #pragma omp critical
2406   {
2407 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
2408     for (int i = 0; i < 10; ++i)
2409       ;
2410   }
2411 #pragma omp critical
2412   {
2413 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
2414     for (int i = 0; i < 10; ++i)
2415       ;
2416   }
2417 #pragma omp critical
2418   {
2419 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
2420     for (int i = 0; i < 10; ++i)
2421       ;
2422   }
2423 #pragma omp critical
2424   {
2425 #pragma omp target teams // OK
2426     a++;
2427   }
2428 #pragma omp critical
2429   {
2430 #pragma omp target teams distribute // OK
2431     for (int i = 0; i < 10; ++i)
2432       ;
2433   }
2434 #pragma omp critical
2435   {
2436 #pragma omp target teams distribute parallel for // OK
2437     for (int i = 0; i < 10; ++i)
2438       ;
2439   }
2440 #pragma omp critical
2441   {
2442 #pragma omp target teams distribute parallel for simd // OK
2443     for (int i = 0; i < 10; ++i)
2444       ;
2445   }
2446 #pragma omp critical
2447   {
2448 #pragma omp target teams distribute simd // OK
2449     for (int i = 0; i < 10; ++i)
2450       ;
2451   }
2452 
2453 // PARALLEL FOR DIRECTIVE
2454 #pragma omp parallel for
2455   for (int i = 0; i < 10; ++i) {
2456 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
2457     for (int i = 0; i < 10; ++i)
2458       ;
2459   }
2460 #pragma omp parallel for
2461   for (int i = 0; i < 10; ++i) {
2462 #pragma omp simd
2463     for (int i = 0; i < 10; ++i)
2464       ;
2465   }
2466 #pragma omp parallel for
2467   for (int i = 0; i < 10; ++i) {
2468 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
2469     for (int i = 0; i < 10; ++i)
2470       ;
2471   }
2472 #pragma omp parallel for
2473   for (int i = 0; i < 10; ++i) {
2474 #pragma omp parallel
2475     for (int i = 0; i < 10; ++i)
2476       ;
2477   }
2478 #pragma omp parallel for
2479   for (int i = 0; i < 10; ++i) {
2480 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
2481     {
2482       bar();
2483     }
2484   }
2485 #pragma omp parallel for
2486   for (int i = 0; i < 10; ++i) {
2487 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel for region}}
2488     {
2489       bar();
2490     }
2491   }
2492 #pragma omp parallel for
2493   for (int i = 0; i < 10; ++i) {
2494 #pragma omp single // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
2495     {
2496       bar();
2497     }
2498   }
2499 
2500 #pragma omp parallel for
2501   for (int i = 0; i < 10; ++i) {
2502 #pragma omp master // expected-error {{region cannot be closely nested inside 'parallel for' region}}
2503     {
2504       bar();
2505     }
2506   }
2507 
2508 #pragma omp parallel for
2509   for (int i = 0; i < 10; ++i) {
2510 #pragma omp critical
2511     {
2512       bar();
2513     }
2514   }
2515 
2516 #pragma omp parallel for
2517   for (int i = 0; i < 10; ++i) {
2518 #pragma omp parallel
2519     {
2520 #pragma omp single // OK
2521       {
2522         bar();
2523       }
2524 #pragma omp for // OK
2525       for (int i = 0; i < 10; ++i)
2526         ;
2527 #pragma omp for simd // OK
2528       for (int i = 0; i < 10; ++i)
2529         ;
2530 #pragma omp sections // OK
2531       {
2532         bar();
2533       }
2534     }
2535   }
2536 #pragma omp parallel for
2537   for (int i = 0; i < 10; ++i) {
2538 #pragma omp parallel for
2539     for (int i = 0; i < 10; ++i)
2540       ;
2541   }
2542 #pragma omp parallel for
2543   for (int i = 0; i < 10; ++i) {
2544 #pragma omp parallel for simd
2545     for (int i = 0; i < 10; ++i)
2546       ;
2547   }
2548 #pragma omp parallel for
2549   for (int i = 0; i < 10; ++i) {
2550 #pragma omp parallel sections
2551     {
2552       bar();
2553     }
2554   }
2555 #pragma omp parallel for
2556   for (int i = 0; i < 10; ++i) {
2557 #pragma omp task
2558     {
2559       bar();
2560     }
2561   }
2562 #pragma omp parallel for
2563   for (int i = 0; i < 10; ++i) {
2564 #pragma omp taskyield
2565     bar();
2566   }
2567 #pragma omp parallel for
2568   for (int i = 0; i < 10; ++i) {
2569 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}}
2570     bar();
2571   }
2572 #pragma omp parallel for
2573   for (int i = 0; i < 10; ++i) {
2574 #pragma omp taskwait
2575     bar();
2576   }
2577 #pragma omp parallel for
2578   for (int i = 0; i < 10; ++i) {
2579 #pragma omp flush
2580     bar();
2581   }
2582 #pragma omp parallel for
2583   for (int i = 0; i < 10; ++i) {
2584 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
2585     bar();
2586   }
2587 #pragma omp parallel for ordered
2588   for (int i = 0; i < 10; ++i) {
2589 #pragma omp ordered // OK
2590     bar();
2591   }
2592 #pragma omp parallel for
2593   for (int i = 0; i < 10; ++i) {
2594 #pragma omp atomic
2595     ++a;
2596   }
2597 #pragma omp parallel for
2598   for (int i = 0; i < 10; ++i) {
2599 #pragma omp target
2600     ++a;
2601   }
2602 #pragma omp parallel for
2603   for (int i = 0; i < 10; ++i) {
2604 #pragma omp target parallel
2605     ++a;
2606   }
2607 #pragma omp parallel for
2608   for (int i = 0; i < 10; ++i) {
2609 #pragma omp target parallel for
2610     for (int i = 0; i < 10; ++i)
2611       ;
2612   }
2613 #pragma omp parallel for
2614   for (int i = 0; i < 10; ++i) {
2615 #pragma omp target enter data map(to: a)
2616     ++a;
2617   }
2618 #pragma omp parallel for
2619   for (int i = 0; i < 10; ++i) {
2620 #pragma omp target exit data map(from: a)
2621     ++a;
2622   }
2623 #pragma omp parallel for
2624   for (int i = 0; i < 10; ++i) {
2625 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
2626     ++a;
2627   }
2628 #pragma omp parallel for
2629   for (int i = 0; i < 10; ++i) {
2630 #pragma omp taskloop
2631   for (int i = 0; i < 10; ++i)
2632     ++a;
2633   }
2634 #pragma omp parallel for
2635   for (int i = 0; i < 10; ++i) {
2636 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
2637     for (int j = 0; j < 10; ++j)
2638       ;
2639   }
2640 #pragma omp parallel for
2641   for (int i = 0; i < 10; ++i) {
2642 #pragma omp target update to(a)
2643   }
2644 #pragma omp parallel for
2645   for (int i = 0; i < 10; ++i) {
2646 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
2647     for (int j = 0; j < 10; ++j)
2648       ;
2649   }
2650 #pragma omp parallel for
2651   for (int i = 0; i < 10; ++i) {
2652 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
2653     for (int j = 0; j < 10; ++j)
2654       ;
2655   }
2656 #pragma omp parallel for
2657   for (int i = 0; i < 10; ++i) {
2658 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
2659     for (int j = 0; j < 10; ++j)
2660       ;
2661   }
2662 #pragma omp parallel for
2663   for (int i = 0; i < 10; ++i) {
2664 #pragma omp target simd // OK
2665     for (int j = 0; j < 10; ++j)
2666       ;
2667   }
2668 #pragma omp parallel for
2669   for (int i = 0; i < 10; ++i) {
2670 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
2671     for (int j = 0; j < 10; ++j)
2672       ;
2673   }
2674 #pragma omp parallel for
2675   for (int i = 0; i < 10; ++i) {
2676 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
2677     for (int j = 0; j < 10; ++j)
2678       ;
2679   }
2680 #pragma omp parallel for
2681   for (int i = 0; i < 10; ++i) {
2682 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
2683     for (int j = 0; j < 10; ++j)
2684       ;
2685   }
2686 #pragma omp parallel for
2687   for (int i = 0; i < 10; ++i) {
2688 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
2689     for (int j = 0; j < 10; ++j)
2690       ;
2691   }
2692 #pragma omp parallel for
2693   for (int i = 0; i < 10; ++i) {
2694 #pragma omp target teams // OK
2695     a++;
2696   }
2697 #pragma omp parallel for
2698   for (int i = 0; i < 10; ++i) {
2699 #pragma omp target teams distribute // OK
2700     for (int j = 0; j < 10; ++j)
2701       ;
2702   }
2703 #pragma omp parallel for
2704   for (int i = 0; i < 10; ++i) {
2705 #pragma omp target teams distribute parallel for // OK
2706     for (int j = 0; j < 10; ++j)
2707       ;
2708   }
2709 #pragma omp parallel for
2710   for (int i = 0; i < 10; ++i) {
2711 #pragma omp target teams distribute parallel for simd // OK
2712     for (int j = 0; j < 10; ++j)
2713       ;
2714   }
2715 #pragma omp parallel for
2716   for (int i = 0; i < 10; ++i) {
2717 #pragma omp target teams distribute simd // OK
2718     for (int j = 0; j < 10; ++j)
2719       ;
2720   }
2721 
2722 // PARALLEL FOR SIMD DIRECTIVE
2723 #pragma omp parallel for simd
2724   for (int i = 0; i < 10; ++i) {
2725 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2726     for (int i = 0; i < 10; ++i)
2727       ;
2728   }
2729 #pragma omp parallel for simd
2730   for (int i = 0; i < 10; ++i) {
2731 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
2732     for (int i = 0; i < 10; ++i)
2733       ;
2734   }
2735 #pragma omp parallel for simd
2736   for (int i = 0; i < 10; ++i) {
2737 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2738     for (int i = 0; i < 10; ++i)
2739       ;
2740   }
2741 #pragma omp parallel for simd
2742   for (int i = 0; i < 10; ++i) {
2743 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2744     for (int i = 0; i < 10; ++i)
2745       ;
2746   }
2747 #pragma omp parallel for simd
2748   for (int i = 0; i < 10; ++i) {
2749 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2750     {
2751       bar();
2752     }
2753   }
2754 #pragma omp parallel for simd
2755   for (int i = 0; i < 10; ++i) {
2756 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2757     {
2758       bar();
2759     }
2760   }
2761 #pragma omp parallel for simd
2762   for (int i = 0; i < 10; ++i) {
2763 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2764     {
2765       bar();
2766     }
2767   }
2768 
2769 #pragma omp parallel for simd
2770   for (int i = 0; i < 10; ++i) {
2771 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2772     {
2773       bar();
2774     }
2775   }
2776 
2777 #pragma omp parallel for simd
2778   for (int i = 0; i < 10; ++i) {
2779 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2780     {
2781       bar();
2782     }
2783   }
2784 
2785 #pragma omp parallel for simd
2786   for (int i = 0; i < 10; ++i) {
2787 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2788     {
2789 #pragma omp single
2790       {
2791         bar();
2792       }
2793 #pragma omp for
2794       for (int i = 0; i < 10; ++i)
2795         ;
2796 #pragma omp for simd
2797       for (int i = 0; i < 10; ++i)
2798         ;
2799 #pragma omp sections
2800       {
2801         bar();
2802       }
2803     }
2804   }
2805 #pragma omp parallel for simd
2806   for (int i = 0; i < 10; ++i) {
2807 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2808     for (int i = 0; i < 10; ++i)
2809       ;
2810   }
2811 #pragma omp parallel for simd
2812   for (int i = 0; i < 10; ++i) {
2813 #pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
2814     for (int i = 0; i < 10; ++i)
2815       ;
2816   }
2817 #pragma omp parallel for simd
2818   for (int i = 0; i < 10; ++i) {
2819 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2820     {
2821       bar();
2822     }
2823   }
2824 #pragma omp parallel for simd
2825   for (int i = 0; i < 10; ++i) {
2826 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2827     {
2828       bar();
2829     }
2830   }
2831 #pragma omp parallel for simd
2832   for (int i = 0; i < 10; ++i) {
2833 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2834     bar();
2835   }
2836 #pragma omp parallel for simd
2837   for (int i = 0; i < 10; ++i) {
2838 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2839     bar();
2840   }
2841 #pragma omp parallel for simd
2842   for (int i = 0; i < 10; ++i) {
2843 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2844     bar();
2845   }
2846 #pragma omp parallel for simd
2847   for (int i = 0; i < 10; ++i) {
2848 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2849     bar();
2850   }
2851 #pragma omp parallel for simd
2852   for (int i = 0; i < 10; ++i) {
2853 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2854     bar();
2855   }
2856 #pragma omp parallel for simd
2857   for (int i = 0; i < 10; ++i) {
2858 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2859     bar();
2860   }
2861 #pragma omp parallel for simd
2862   for (int i = 0; i < 10; ++i) {
2863 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
2864     ++a;
2865   }
2866 #pragma omp parallel for simd
2867   for (int i = 0; i < 10; ++i) {
2868 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2869     ++a;
2870   }
2871 #pragma omp parallel for simd
2872   for (int i = 0; i < 10; ++i) {
2873 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2874     ++a;
2875   }
2876 #pragma omp parallel for simd
2877   for (int i = 0; i < 10; ++i) {
2878 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2879     for (int i = 0; i < 10; ++i)
2880       ;
2881   }
2882 #pragma omp parallel for simd
2883   for (int i = 0; i < 10; ++i) {
2884 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2885     ++a;
2886   }
2887 #pragma omp parallel for simd
2888   for (int i = 0; i < 10; ++i) {
2889 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2890     ++a;
2891   }
2892 #pragma omp parallel for simd
2893   for (int i = 0; i < 10; ++i) {
2894 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2895     ++a;
2896   }
2897 #pragma omp parallel for simd
2898   for (int i = 0; i < 10; ++i) {
2899 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2900   for (int i = 0; i < 10; ++i)
2901     ++a;
2902   }
2903 #pragma omp parallel for simd
2904   for (int i = 0; i < 10; ++i) {
2905 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2906     for (int j = 0; j < 10; ++j)
2907       ;
2908   }
2909 #pragma omp parallel for simd
2910   for (int i = 0; i < 10; ++i) {
2911 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2912     bar();
2913   }
2914 #pragma omp parallel for simd
2915   for (int i = 0; i < 10; ++i) {
2916 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2917     for (int j = 0; j < 10; ++j)
2918       ;
2919   }
2920 #pragma omp parallel for simd
2921   for (int i = 0; i < 10; ++i) {
2922 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2923     for (int j = 0; j < 10; ++j)
2924       ;
2925   }
2926 #pragma omp parallel for simd
2927   for (int i = 0; i < 10; ++i) {
2928 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2929     for (int j = 0; j < 10; ++j)
2930       ;
2931   }
2932 #pragma omp parallel for simd
2933   for (int i = 0; i < 10; ++i) {
2934 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2935     for (int j = 0; j < 10; ++j)
2936       ;
2937   }
2938 #pragma omp parallel for simd
2939   for (int i = 0; i < 10; ++i) {
2940 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2941     for (int j = 0; j < 10; ++j)
2942       ;
2943   }
2944 #pragma omp parallel for simd
2945   for (int i = 0; i < 10; ++i) {
2946 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2947     for (int j = 0; j < 10; ++j)
2948       ;
2949   }
2950 #pragma omp parallel for simd
2951   for (int i = 0; i < 10; ++i) {
2952 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2953     for (int j = 0; j < 10; ++j)
2954       ;
2955   }
2956 #pragma omp parallel for simd
2957   for (int i = 0; i < 10; ++i) {
2958 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2959     for (int j = 0; j < 10; ++j)
2960       ;
2961   }
2962 #pragma omp parallel for simd
2963   for (int i = 0; i < 10; ++i) {
2964 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2965     a++;
2966   }
2967 #pragma omp parallel for simd
2968   for (int i = 0; i < 10; ++i) {
2969 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2970     for (int j = 0; j < 10; ++j)
2971       ;
2972   }
2973 #pragma omp parallel for simd
2974   for (int i = 0; i < 10; ++i) {
2975 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2976     for (int j = 0; j < 10; ++j)
2977       ;
2978   }
2979 #pragma omp parallel for simd
2980   for (int i = 0; i < 10; ++i) {
2981 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2982     for (int j = 0; j < 10; ++j)
2983       ;
2984   }
2985 #pragma omp parallel for simd
2986   for (int i = 0; i < 10; ++i) {
2987 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2988     for (int j = 0; j < 10; ++j)
2989       ;
2990   }
2991 
2992 // PARALLEL MASTER DIRECTIVE
2993 #pragma omp parallel master
2994   {
2995 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
2996     for (int i = 0; i < 10; ++i)
2997       ;
2998   }
2999 #pragma omp parallel master
3000   {
3001 #pragma omp simd
3002     for (int i = 0; i < 10; ++i)
3003       ;
3004   }
3005 #pragma omp parallel master
3006   {
3007 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3008     for (int i = 0; i < 10; ++i)
3009       ;
3010   }
3011 #pragma omp parallel master
3012   {
3013 #pragma omp parallel
3014     for (int i = 0; i < 10; ++i)
3015       ;
3016   }
3017 #pragma omp parallel master
3018   {
3019 #pragma omp single // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3020     {
3021       bar();
3022     }
3023   }
3024 #pragma omp parallel master
3025   {
3026 #pragma omp master // OK, though second 'master' is redundant
3027     {
3028       bar();
3029     }
3030   }
3031 #pragma omp parallel master
3032   {
3033 #pragma omp critical
3034     {
3035       bar();
3036     }
3037   }
3038 #pragma omp parallel master
3039   {
3040 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3041     {
3042       bar();
3043     }
3044   }
3045 #pragma omp parallel master
3046   {
3047 #pragma omp parallel
3048     {
3049 #pragma omp parallel master // OK
3050       {
3051         bar();
3052       }
3053 #pragma omp for // OK
3054       for (int i = 0; i < 10; ++i)
3055         ;
3056 #pragma omp for simd // OK
3057       for (int i = 0; i < 10; ++i)
3058         ;
3059 #pragma omp sections // OK
3060       {
3061         bar();
3062       }
3063     }
3064   }
3065 #pragma omp parallel master
3066   {
3067 #pragma omp parallel master // OK
3068       {
3069         bar();
3070       }
3071 #pragma omp parallel
3072     {
3073 #pragma omp for // OK
3074       for (int i = 0; i < 10; ++i)
3075         ;
3076 #pragma omp for simd // OK
3077       for (int i = 0; i < 10; ++i)
3078         ;
3079 #pragma omp sections // OK
3080       {
3081         bar();
3082       }
3083     }
3084   }
3085 #pragma omp parallel master
3086   {
3087 #pragma omp parallel for
3088     for (int i = 0; i < 10; ++i)
3089       ;
3090   }
3091 #pragma omp parallel master
3092   {
3093 #pragma omp parallel for simd
3094     for (int i = 0; i < 10; ++i)
3095       ;
3096   }
3097 #pragma omp parallel master
3098   {
3099 #pragma omp parallel sections
3100     {
3101       bar();
3102     }
3103   }
3104 #pragma omp parallel master
3105   {
3106 #pragma omp task
3107     {
3108       bar();
3109     }
3110   }
3111 #pragma omp parallel master
3112   {
3113 #pragma omp taskyield
3114     bar();
3115   }
3116 #pragma omp parallel master
3117   {
3118 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel master' region}}
3119     bar();
3120   }
3121 #pragma omp parallel master
3122   {
3123 #pragma omp taskwait
3124     bar();
3125   }
3126 #pragma omp parallel master
3127   {
3128 #pragma omp flush
3129     bar();
3130   }
3131 #pragma omp parallel master
3132   {
3133 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3134     bar();
3135   }
3136 #pragma omp parallel master
3137   {
3138 #pragma omp atomic
3139     ++a;
3140   }
3141 #pragma omp parallel master
3142   {
3143 #pragma omp target
3144     ++a;
3145   }
3146 #pragma omp parallel master
3147   {
3148 #pragma omp target parallel
3149     ++a;
3150   }
3151 #pragma omp parallel master
3152   {
3153 #pragma omp target parallel for
3154     for (int i = 0; i < 10; ++i)
3155       ;
3156   }
3157 #pragma omp parallel master
3158   {
3159 #pragma omp target enter data map(to: a)
3160     ++a;
3161   }
3162 #pragma omp parallel master
3163   {
3164 #pragma omp target exit data map(from: a)
3165     ++a;
3166   }
3167 #pragma omp parallel master
3168   {
3169 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3170     ++a;
3171   }
3172 #pragma omp parallel master
3173   {
3174 #pragma omp taskloop
3175   for (int i = 0; i < 10; ++i)
3176     ++a;
3177   }
3178 #pragma omp parallel master
3179   {
3180 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
3181     for (int i = 0; i < 10; ++i)
3182       ;
3183   }
3184 #pragma omp parallel master
3185   {
3186 #pragma omp target update to(a)
3187     bar();
3188   }
3189 #pragma omp parallel master
3190   {
3191 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
3192     for (int i = 0; i < 10; ++i)
3193       ;
3194   }
3195 #pragma omp parallel master
3196   {
3197 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
3198     for (int i = 0; i < 10; ++i)
3199       ;
3200   }
3201 #pragma omp parallel master
3202   {
3203 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
3204     for (int i = 0; i < 10; ++i)
3205       ;
3206   }
3207 #pragma omp parallel master
3208   {
3209 #pragma omp target simd // OK
3210     for (int i = 0; i < 10; ++i)
3211       ;
3212   }
3213 #pragma omp parallel master
3214   {
3215 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
3216     for (int i = 0; i < 10; ++i)
3217       ;
3218   }
3219 #pragma omp parallel master
3220   {
3221 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
3222     for (int i = 0; i < 10; ++i)
3223       ;
3224   }
3225 #pragma omp parallel master
3226   {
3227 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
3228     for (int i = 0; i < 10; ++i)
3229       ;
3230   }
3231 #pragma omp parallel master
3232   {
3233 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel master' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
3234     for (int i = 0; i < 10; ++i)
3235       ;
3236   }
3237 #pragma omp parallel master
3238   {
3239 #pragma omp target teams // OK
3240     a++;
3241   }
3242 #pragma omp parallel master
3243   {
3244 #pragma omp target teams distribute // OK
3245     for (int i = 0; i < 10; ++i)
3246       ;
3247   }
3248 #pragma omp parallel master
3249   {
3250 #pragma omp target teams distribute parallel for // OK
3251     for (int i = 0; i < 10; ++i)
3252       ;
3253   }
3254 #pragma omp parallel master
3255   {
3256 #pragma omp target teams distribute parallel for simd // OK
3257     for (int i = 0; i < 10; ++i)
3258       ;
3259   }
3260 #pragma omp parallel master
3261   {
3262 #pragma omp target teams distribute simd // OK
3263     for (int i = 0; i < 10; ++i)
3264       ;
3265   }
3266 
3267 // PARALLEL SECTIONS DIRECTIVE
3268 #pragma omp parallel sections
3269   {
3270 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
3271     for (int i = 0; i < 10; ++i)
3272       ;
3273   }
3274 #pragma omp parallel sections
3275   {
3276 #pragma omp simd
3277     for (int i = 0; i < 10; ++i)
3278       ;
3279   }
3280 #pragma omp parallel sections
3281   {
3282 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3283     for (int i = 0; i < 10; ++i)
3284       ;
3285   }
3286 #pragma omp parallel sections
3287   {
3288 #pragma omp parallel
3289     for (int i = 0; i < 10; ++i)
3290       ;
3291   }
3292 #pragma omp parallel sections
3293   {
3294 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3295     {
3296       bar();
3297     }
3298   }
3299 #pragma omp parallel sections
3300   {
3301 #pragma omp section
3302     {
3303       bar();
3304     }
3305   }
3306 #pragma omp parallel sections
3307   {
3308 #pragma omp section
3309     {
3310 #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3311       bar();
3312     }
3313   }
3314 #pragma omp parallel sections
3315   {
3316 #pragma omp section
3317     {
3318 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
3319       bar();
3320     }
3321   }
3322 #pragma omp parallel sections
3323   {
3324 #pragma omp section
3325     {
3326 #pragma omp critical
3327       bar();
3328     }
3329   }
3330 #pragma omp parallel sections
3331   {
3332 #pragma omp parallel
3333     {
3334 #pragma omp single // OK
3335       {
3336         bar();
3337       }
3338 #pragma omp for // OK
3339       for (int i = 0; i < 10; ++i)
3340         ;
3341 #pragma omp for simd // OK
3342       for (int i = 0; i < 10; ++i)
3343         ;
3344 #pragma omp sections // OK
3345       {
3346         bar();
3347       }
3348     }
3349   }
3350 #pragma omp parallel sections
3351   {
3352 #pragma omp parallel for
3353     for (int i = 0; i < 10; ++i)
3354       ;
3355   }
3356 #pragma omp parallel sections
3357   {
3358 #pragma omp parallel for simd
3359     for (int i = 0; i < 10; ++i)
3360       ;
3361   }
3362 #pragma omp parallel sections
3363   {
3364 #pragma omp parallel sections
3365     {
3366       bar();
3367     }
3368   }
3369 #pragma omp parallel sections
3370   {
3371 #pragma omp task
3372     {
3373       bar();
3374     }
3375   }
3376 #pragma omp parallel sections
3377   {
3378 #pragma omp taskyield
3379   }
3380 #pragma omp parallel sections
3381   {
3382 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}}
3383   }
3384 #pragma omp parallel sections
3385   {
3386 #pragma omp taskwait
3387   }
3388 #pragma omp parallel sections
3389   {
3390 #pragma omp flush
3391   }
3392 #pragma omp parallel sections
3393   {
3394 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3395     bar();
3396   }
3397 #pragma omp parallel sections
3398   {
3399 #pragma omp atomic
3400     ++a;
3401   }
3402 #pragma omp parallel sections
3403   {
3404 #pragma omp target
3405     ++a;
3406   }
3407 #pragma omp parallel sections
3408   {
3409 #pragma omp target parallel
3410     ++a;
3411   }
3412 #pragma omp parallel sections
3413   {
3414 #pragma omp target parallel for
3415     for (int i = 0; i < 10; ++i)
3416       ;
3417   }
3418 #pragma omp parallel sections
3419   {
3420 #pragma omp target enter data map(to: a)
3421   }
3422 #pragma omp parallel sections
3423   {
3424 #pragma omp target exit data map(from: a)
3425   }
3426 #pragma omp parallel sections
3427   {
3428 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3429     ++a;
3430   }
3431 #pragma omp parallel sections
3432   {
3433 #pragma omp taskloop
3434   for (int i = 0; i < 10; ++i)
3435     ++a;
3436   }
3437 #pragma omp parallel sections
3438   {
3439 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
3440     for (int i = 0; i < 10; ++i)
3441       ;
3442   }
3443 #pragma omp parallel sections
3444   {
3445 #pragma omp target update to(a)
3446   }
3447 #pragma omp parallel sections
3448   {
3449 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
3450     for (int i = 0; i < 10; ++i)
3451       ;
3452   }
3453 #pragma omp parallel sections
3454   {
3455 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
3456     for (int i = 0; i < 10; ++i)
3457       ;
3458   }
3459 #pragma omp parallel sections
3460   {
3461 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
3462     for (int i = 0; i < 10; ++i)
3463       ;
3464   }
3465 #pragma omp parallel sections
3466   {
3467 #pragma omp target simd // OK
3468     for (int i = 0; i < 10; ++i)
3469       ;
3470   }
3471 #pragma omp parallel sections
3472   {
3473 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
3474     for (int i = 0; i < 10; ++i)
3475       ;
3476   }
3477 #pragma omp parallel sections
3478   {
3479 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
3480     for (int i = 0; i < 10; ++i)
3481       ;
3482   }
3483 #pragma omp parallel sections
3484   {
3485 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
3486     for (int i = 0; i < 10; ++i)
3487       ;
3488   }
3489 #pragma omp parallel sections
3490   {
3491 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
3492     for (int i = 0; i < 10; ++i)
3493       ;
3494   }
3495 #pragma omp parallel sections
3496   {
3497 #pragma omp target teams // OK
3498     a++;
3499   }
3500 #pragma omp parallel sections
3501   {
3502 #pragma omp target teams distribute // OK
3503     for (int i = 0; i < 10; ++i)
3504       ;
3505   }
3506 #pragma omp parallel sections
3507   {
3508 #pragma omp target teams distribute parallel for // OK
3509     for (int i = 0; i < 10; ++i)
3510       ;
3511   }
3512 #pragma omp parallel sections
3513   {
3514 #pragma omp target teams distribute parallel for simd // OK
3515     for (int i = 0; i < 10; ++i)
3516       ;
3517   }
3518 #pragma omp parallel sections
3519   {
3520 #pragma omp target teams distribute simd // OK
3521     for (int i = 0; i < 10; ++i)
3522       ;
3523   }
3524 
3525 // TASK DIRECTIVE
3526 #pragma omp task
3527 #pragma omp for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
3528   for (int i = 0; i < 10; ++i)
3529     ;
3530 #pragma omp task
3531 #pragma omp simd
3532   for (int i = 0; i < 10; ++i)
3533     ;
3534 #pragma omp task
3535 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3536   for (int i = 0; i < 10; ++i)
3537     ;
3538 #pragma omp task
3539 #pragma omp sections // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3540   {
3541     bar();
3542   }
3543 #pragma omp task
3544 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a task region}}
3545   {
3546     bar();
3547   }
3548 #pragma omp task
3549 #pragma omp single // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3550   bar();
3551 #pragma omp task
3552 #pragma omp master // expected-error {{region cannot be closely nested inside 'task' region}}
3553   bar();
3554 #pragma omp task
3555 #pragma omp critical
3556   bar();
3557 
3558 #pragma omp task
3559 #pragma omp parallel for
3560   for (int i = 0; i < 10; ++i)
3561     ;
3562 #pragma omp task
3563 #pragma omp parallel for simd
3564   for (int i = 0; i < 10; ++i)
3565     ;
3566 #pragma omp task
3567 #pragma omp parallel sections
3568   {
3569     bar();
3570   }
3571 #pragma omp task
3572 #pragma omp task
3573   {
3574     bar();
3575   }
3576 #pragma omp task
3577   {
3578 #pragma omp taskyield
3579     bar();
3580   }
3581 #pragma omp task
3582   {
3583 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}}
3584     bar();
3585   }
3586 #pragma omp task
3587   {
3588 #pragma omp taskwait
3589     bar();
3590   }
3591 #pragma omp task
3592   {
3593 #pragma omp flush
3594     bar();
3595   }
3596 #pragma omp task
3597   {
3598 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3599     bar();
3600   }
3601 #pragma omp task
3602   {
3603 #pragma omp atomic
3604     ++a;
3605   }
3606 #pragma omp task
3607   {
3608 #pragma omp target
3609     ++a;
3610   }
3611 #pragma omp task
3612   {
3613 #pragma omp target parallel
3614     ++a;
3615   }
3616 #pragma omp task
3617 #pragma omp target parallel for
3618   for (int i = 0; i < 10; ++i)
3619     ;
3620 #pragma omp task
3621   {
3622 #pragma omp target enter data map(to: a)
3623     ++a;
3624   }
3625 #pragma omp task
3626   {
3627 #pragma omp target exit data map(from: a)
3628     ++a;
3629   }
3630 #pragma omp task
3631   {
3632 #pragma omp teams // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3633     ++a;
3634   }
3635 #pragma omp task
3636   {
3637 #pragma omp taskloop
3638   for (int i = 0; i < 10; ++i)
3639     ++a;
3640   }
3641 #pragma omp task
3642   {
3643 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
3644     for (int i = 0; i < 10; ++i)
3645       ;
3646   }
3647 #pragma omp task
3648   {
3649 #pragma omp target update to(a)
3650     bar();
3651   }
3652 #pragma omp task
3653   {
3654 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
3655     for (int i = 0; i < 10; ++i)
3656       ;
3657   }
3658 #pragma omp task
3659   {
3660 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
3661     for (int i = 0; i < 10; ++i)
3662       ;
3663   }
3664 #pragma omp task
3665   {
3666 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
3667     for (int i = 0; i < 10; ++i)
3668       ;
3669   }
3670 #pragma omp task
3671   {
3672 #pragma omp target simd // OK
3673     for (int i = 0; i < 10; ++i)
3674       ;
3675   }
3676 #pragma omp task
3677   {
3678 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
3679     for (int i = 0; i < 10; ++i)
3680       ;
3681   }
3682 #pragma omp task
3683   {
3684 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
3685     for (int i = 0; i < 10; ++i)
3686       ;
3687   }
3688 #pragma omp task
3689   {
3690 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
3691     for (int i = 0; i < 10; ++i)
3692       ;
3693   }
3694 #pragma omp task
3695   {
3696 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
3697     for (int i = 0; i < 10; ++i)
3698       ;
3699   }
3700 #pragma omp task
3701   {
3702 #pragma omp target teams // OK
3703     a++;
3704   }
3705 #pragma omp task
3706   {
3707 #pragma omp target teams distribute // OK
3708     for (int i = 0; i < 10; ++i)
3709       ;
3710   }
3711 #pragma omp task
3712   {
3713 #pragma omp target teams distribute parallel for // OK
3714     for (int i = 0; i < 10; ++i)
3715       ;
3716   }
3717 #pragma omp task
3718   {
3719 #pragma omp target teams distribute parallel for simd // OK
3720     for (int i = 0; i < 10; ++i)
3721       ;
3722   }
3723 #pragma omp task
3724   {
3725 #pragma omp target teams distribute simd // OK
3726     for (int i = 0; i < 10; ++i)
3727       ;
3728   }
3729 
3730 // ORDERED DIRECTIVE
3731 #pragma omp ordered
3732   {
3733 #pragma omp for // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
3734     for (int i = 0; i < 10; ++i)
3735       ;
3736   }
3737 #pragma omp ordered
3738   {
3739 #pragma omp simd
3740     for (int i = 0; i < 10; ++i)
3741       ;
3742   }
3743 #pragma omp ordered
3744   {
3745 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
3746     for (int i = 0; i < 10; ++i)
3747       ;
3748   }
3749 #pragma omp ordered
3750   {
3751 #pragma omp parallel
3752     for (int i = 0; i < 10; ++i)
3753       ;
3754   }
3755 #pragma omp ordered
3756   {
3757 #pragma omp single // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
3758     {
3759       bar();
3760     }
3761   }
3762 #pragma omp ordered
3763   {
3764 #pragma omp master // OK, though second 'ordered' is redundant
3765     {
3766       bar();
3767     }
3768   }
3769 #pragma omp ordered
3770   {
3771 #pragma omp critical
3772     {
3773       bar();
3774     }
3775   }
3776 #pragma omp ordered
3777   {
3778 #pragma omp sections // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
3779     {
3780       bar();
3781     }
3782   }
3783 #pragma omp ordered
3784   {
3785 #pragma omp parallel for ordered
3786     for (int j = 0; j < 10; ++j) {
3787 #pragma omp ordered // OK
3788       {
3789         bar();
3790       }
3791     }
3792   }
3793 #pragma omp ordered
3794   {
3795 #pragma omp parallel for simd ordered
3796     for (int j = 0; j < 10; ++j) {
3797 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3798       {
3799         bar();
3800       }
3801     }
3802   }
3803 #pragma omp ordered
3804   {
3805 #pragma omp parallel for simd ordered
3806     for (int j = 0; j < 10; ++j) {
3807 #pragma omp ordered simd
3808       {
3809         bar();
3810       }
3811     }
3812   }
3813 #pragma omp ordered
3814   {
3815 #pragma omp parallel for
3816     for (int i = 0; i < 10; ++i)
3817       ;
3818   }
3819 #pragma omp ordered
3820   {
3821 #pragma omp parallel for simd
3822     for (int i = 0; i < 10; ++i)
3823       ;
3824   }
3825 #pragma omp ordered
3826   {
3827 #pragma omp parallel sections
3828     {
3829       bar();
3830     }
3831   }
3832 #pragma omp ordered
3833   {
3834 #pragma omp task
3835     {
3836       bar();
3837     }
3838   }
3839 #pragma omp ordered
3840   {
3841 #pragma omp taskyield
3842     bar();
3843   }
3844 #pragma omp ordered
3845   {
3846 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'ordered' region}}
3847     bar();
3848   }
3849 #pragma omp ordered
3850   {
3851 #pragma omp taskwait
3852     bar();
3853   }
3854 #pragma omp ordered
3855   {
3856 #pragma omp flush
3857     bar();
3858   }
3859 #pragma omp ordered
3860   {
3861 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
3862     bar();
3863   }
3864 #pragma omp ordered
3865   {
3866 #pragma omp atomic
3867     ++a;
3868   }
3869 #pragma omp ordered
3870   {
3871 #pragma omp target
3872     ++a;
3873   }
3874 #pragma omp ordered
3875   {
3876 #pragma omp target parallel
3877     ++a;
3878   }
3879 #pragma omp ordered
3880   {
3881 #pragma omp target parallel for ordered
3882     for (int j = 0; j < 10; ++j) {
3883 #pragma omp ordered // OK
3884       {
3885         bar();
3886       }
3887     }
3888   }
3889 #pragma omp ordered
3890   {
3891 #pragma omp target parallel for
3892     for (int i = 0; i < 10; ++i)
3893       ;
3894   }
3895 #pragma omp ordered
3896   {
3897 #pragma omp target enter data map(to: a)
3898     ++a;
3899   }
3900 #pragma omp ordered
3901   {
3902 #pragma omp target exit data map(from: a)
3903     ++a;
3904   }
3905 #pragma omp ordered
3906   {
3907 #pragma omp teams // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
3908     ++a;
3909   }
3910 #pragma omp ordered
3911   {
3912 #pragma omp taskloop
3913   for (int i = 0; i < 10; ++i)
3914     ++a;
3915   }
3916 #pragma omp ordered
3917   {
3918 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
3919     for (int i = 0; i < 10; ++i)
3920       ;
3921   }
3922 #pragma omp ordered
3923   {
3924     bar();
3925 #pragma omp target update to(a)
3926     bar();
3927   }
3928 #pragma omp ordered
3929   {
3930 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
3931     for (int i = 0; i < 10; ++i)
3932       ;
3933   }
3934 #pragma omp ordered
3935   {
3936 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
3937     for (int i = 0; i < 10; ++i)
3938       ;
3939   }
3940 #pragma omp ordered
3941   {
3942 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
3943     for (int i = 0; i < 10; ++i)
3944       ;
3945   }
3946 #pragma omp ordered
3947   {
3948 #pragma omp target simd // OK
3949     for (int i = 0; i < 10; ++i)
3950       ;
3951   }
3952 #pragma omp ordered
3953   {
3954 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
3955     for (int i = 0; i < 10; ++i)
3956       ;
3957   }
3958 #pragma omp ordered
3959   {
3960 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
3961     for (int i = 0; i < 10; ++i)
3962       ;
3963   }
3964 #pragma omp ordered
3965   {
3966 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
3967     for (int i = 0; i < 10; ++i)
3968       ;
3969   }
3970 #pragma omp ordered
3971   {
3972 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
3973     for (int i = 0; i < 10; ++i)
3974       ;
3975   }
3976 #pragma omp ordered
3977   {
3978 #pragma omp target teams // OK
3979     a++;
3980   }
3981 #pragma omp ordered
3982   {
3983 #pragma omp target teams distribute // OK
3984     for (int i = 0; i < 10; ++i)
3985       ;
3986   }
3987 #pragma omp ordered
3988   {
3989 #pragma omp target teams distribute parallel for // OK
3990     for (int i = 0; i < 10; ++i)
3991       ;
3992   }
3993 #pragma omp ordered
3994   {
3995 #pragma omp target teams distribute parallel for simd // OK
3996     for (int i = 0; i < 10; ++i)
3997       ;
3998   }
3999 #pragma omp ordered
4000   {
4001 #pragma omp target teams distribute simd // OK
4002     for (int i = 0; i < 10; ++i)
4003       ;
4004   }
4005 
4006 // ATOMIC DIRECTIVE
4007 #pragma omp atomic
4008   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4009   // expected-note@+1 {{expected an expression statement}}
4010   {
4011 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4012     for (int i = 0; i < 10; ++i)
4013       ;
4014   }
4015 #pragma omp atomic
4016   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4017   // expected-note@+1 {{expected an expression statement}}
4018   {
4019 #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4020     for (int i = 0; i < 10; ++i)
4021       ;
4022   }
4023 #pragma omp atomic
4024   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4025   // expected-note@+1 {{expected an expression statement}}
4026   {
4027 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4028     for (int i = 0; i < 10; ++i)
4029       ;
4030   }
4031 #pragma omp atomic
4032   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4033   // expected-note@+1 {{expected an expression statement}}
4034   {
4035 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4036     for (int i = 0; i < 10; ++i)
4037       ;
4038   }
4039 #pragma omp atomic
4040   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4041   // expected-note@+1 {{expected an expression statement}}
4042   {
4043 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4044     {
4045       bar();
4046     }
4047   }
4048 #pragma omp atomic
4049   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4050   // expected-note@+1 {{expected an expression statement}}
4051   {
4052 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4053     {
4054       bar();
4055     }
4056   }
4057 #pragma omp atomic
4058   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4059   // expected-note@+1 {{expected an expression statement}}
4060   {
4061 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4062     {
4063       bar();
4064     }
4065   }
4066 #pragma omp atomic
4067   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4068   // expected-note@+1 {{expected an expression statement}}
4069   {
4070 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4071     {
4072       bar();
4073     }
4074   }
4075 #pragma omp atomic
4076   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4077   // expected-note@+1 {{expected an expression statement}}
4078   {
4079 #pragma omp parallel master // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4080     {
4081       bar();
4082     }
4083   }
4084 #pragma omp atomic
4085   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4086   // expected-note@+1 {{expected an expression statement}}
4087   {
4088 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4089     {
4090       bar();
4091     }
4092   }
4093 #pragma omp atomic
4094   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4095   // expected-note@+1 {{expected an expression statement}}
4096   {
4097 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4098     for (int i = 0; i < 10; ++i)
4099       ;
4100   }
4101 #pragma omp atomic
4102   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4103   // expected-note@+1 {{expected an expression statement}}
4104   {
4105 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4106     for (int i = 0; i < 10; ++i)
4107       ;
4108   }
4109 #pragma omp atomic
4110   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4111   // expected-note@+1 {{expected an expression statement}}
4112   {
4113 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4114     {
4115       bar();
4116     }
4117   }
4118 #pragma omp atomic
4119   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4120   // expected-note@+1 {{expected an expression statement}}
4121   {
4122 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4123     {
4124       bar();
4125     }
4126   }
4127 #pragma omp atomic
4128   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4129   // expected-note@+1 {{expected an expression statement}}
4130   {
4131 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4132     bar();
4133   }
4134 #pragma omp atomic
4135   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4136   // expected-note@+1 {{expected an expression statement}}
4137   {
4138 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4139     bar();
4140   }
4141 #pragma omp atomic
4142   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4143   // expected-note@+1 {{expected an expression statement}}
4144   {
4145 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4146     bar();
4147   }
4148 #pragma omp atomic
4149   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4150   // expected-note@+1 {{expected an expression statement}}
4151   {
4152 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4153     bar();
4154   }
4155 #pragma omp atomic
4156   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4157   // expected-note@+1 {{expected an expression statement}}
4158   {
4159 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4160     bar();
4161   }
4162 #pragma omp atomic
4163   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4164   // expected-note@+1 {{expected an expression statement}}
4165   {
4166 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4167     ++a;
4168   }
4169 #pragma omp atomic
4170   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4171   // expected-note@+1 {{expected an expression statement}}
4172   {
4173 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4174     ++a;
4175   }
4176 #pragma omp atomic
4177   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4178   // expected-note@+1 {{expected an expression statement}}
4179   {
4180 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4181     ++a;
4182   }
4183 #pragma omp atomic
4184   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4185   // expected-note@+1 {{expected an expression statement}}
4186   {
4187 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4188     for (int i = 0; i < 10; ++i)
4189       ;
4190   }
4191 #pragma omp atomic
4192   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4193   // expected-note@+1 {{expected an expression statement}}
4194   {
4195 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4196     ++a;
4197   }
4198 #pragma omp atomic
4199   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4200   // expected-note@+1 {{expected an expression statement}}
4201   {
4202 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4203     ++a;
4204   }
4205 #pragma omp atomic
4206   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4207   // expected-note@+1 {{expected an expression statement}}
4208   {
4209 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4210     ++a;
4211   }
4212 #pragma omp atomic
4213   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4214   // expected-note@+1 {{expected an expression statement}}
4215   {
4216 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4217   for (int i = 0; i < 10; ++i)
4218     ++a;
4219   }
4220 #pragma omp atomic
4221   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4222   // expected-note@+1 {{expected an expression statement}}
4223   {
4224 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4225     for (int i = 0; i < 10; ++i)
4226       ;
4227   }
4228 #pragma omp atomic
4229   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4230   // expected-note@+1 {{expected an expression statement}}
4231   {
4232 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4233     bar();
4234   }
4235 #pragma omp atomic
4236   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4237   // expected-note@+1 {{expected an expression statement}}
4238   {
4239 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4240     for (int i = 0; i < 10; ++i)
4241       ;
4242   }
4243 #pragma omp atomic
4244   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4245   // expected-note@+1 {{expected an expression statement}}
4246   {
4247 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4248     for (int i = 0; i < 10; ++i)
4249       ;
4250   }
4251 #pragma omp atomic
4252   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4253   // expected-note@+1 {{expected an expression statement}}
4254   {
4255 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4256     for (int i = 0; i < 10; ++i)
4257       ;
4258   }
4259 #pragma omp atomic
4260   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4261   // expected-note@+1 {{expected an expression statement}}
4262   {
4263 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4264     for (int i = 0; i < 10; ++i)
4265       ;
4266   }
4267 #pragma omp atomic
4268   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4269   // expected-note@+1 {{expected an expression statement}}
4270   {
4271 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4272     for (int i = 0; i < 10; ++i)
4273       ;
4274   }
4275 #pragma omp atomic
4276   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4277   // expected-note@+1 {{expected an expression statement}}
4278   {
4279 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4280     for (int i = 0; i < 10; ++i)
4281       ;
4282   }
4283 #pragma omp atomic
4284   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4285   // expected-note@+1 {{expected an expression statement}}
4286   {
4287 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4288     for (int i = 0; i < 10; ++i)
4289       ;
4290   }
4291 #pragma omp atomic
4292   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4293   // expected-note@+1 {{expected an expression statement}}
4294   {
4295 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4296     for (int i = 0; i < 10; ++i)
4297       ;
4298   }
4299 #pragma omp atomic
4300   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4301   // expected-note@+1 {{expected an expression statement}}
4302   {
4303 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4304     a++;
4305   }
4306 #pragma omp atomic
4307   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4308   // expected-note@+1 {{expected an expression statement}}
4309   {
4310 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4311     for (int i = 0; i < 10; ++i)
4312       ;
4313   }
4314 #pragma omp atomic
4315   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4316   // expected-note@+1 {{expected an expression statement}}
4317   {
4318 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4319     for (int i = 0; i < 10; ++i)
4320       ;
4321   }
4322 #pragma omp atomic
4323   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4324   // expected-note@+1 {{expected an expression statement}}
4325   {
4326 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4327     for (int i = 0; i < 10; ++i)
4328       ;
4329   }
4330 #pragma omp atomic
4331   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
4332   // expected-note@+1 {{expected an expression statement}}
4333   {
4334 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
4335     for (int i = 0; i < 10; ++i)
4336       ;
4337   }
4338 
4339 // TARGET DIRECTIVE
4340 #pragma omp target
4341 #pragma omp parallel
4342   bar();
4343 #pragma omp target
4344 #pragma omp for
4345   for (int i = 0; i < 10; ++i)
4346     ;
4347 #pragma omp target
4348 #pragma omp simd
4349   for (int i = 0; i < 10; ++i)
4350     ;
4351 #pragma omp target
4352 #pragma omp for simd
4353   for (int i = 0; i < 10; ++i)
4354     ;
4355 #pragma omp target
4356 #pragma omp sections
4357   {
4358     bar();
4359   }
4360 #pragma omp target
4361 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target region}}
4362   {
4363     bar();
4364   }
4365 #pragma omp target
4366 #pragma omp single
4367   bar();
4368 
4369 #pragma omp target
4370 #pragma omp master
4371   {
4372     bar();
4373   }
4374 #pragma omp target
4375 #pragma omp critical
4376   {
4377     bar();
4378   }
4379 #pragma omp target
4380 #pragma omp parallel for
4381   for (int i = 0; i < 10; ++i)
4382     ;
4383 #pragma omp target
4384 #pragma omp parallel for simd
4385   for (int i = 0; i < 10; ++i)
4386     ;
4387 #pragma omp target
4388 #pragma omp parallel sections
4389   {
4390     bar();
4391   }
4392 #pragma omp target
4393 #pragma omp task
4394   {
4395     bar();
4396   }
4397 #pragma omp target
4398   {
4399 #pragma omp taskyield
4400     bar();
4401   }
4402 #pragma omp target
4403   {
4404 #pragma omp barrier
4405     bar();
4406   }
4407 #pragma omp target
4408   {
4409 #pragma omp taskwait
4410     bar();
4411   }
4412 #pragma omp target
4413   {
4414 #pragma omp flush
4415     bar();
4416   }
4417 #pragma omp target
4418   {
4419 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
4420     bar();
4421   }
4422 #pragma omp target
4423   {
4424 #pragma omp atomic
4425     ++a;
4426   }
4427 #pragma omp target
4428   {
4429 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
4430     ++a;
4431   }
4432 #pragma omp target
4433   {
4434 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
4435     ++a;
4436   }
4437 #pragma omp target
4438 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
4439   for (int i = 0; i < 10; ++i)
4440     ;
4441 #pragma omp target
4442   {
4443 #pragma omp teams
4444     ++a;
4445   }
4446 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
4447   {
4448 #pragma omp teams // expected-note {{directive outside teams construct here}}
4449     ++a;
4450 #pragma omp teams // expected-note {{nested teams construct here}}
4451     ++a;
4452   }
4453 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
4454   {
4455     ++a;           // expected-note {{statement outside teams construct here}}
4456 #pragma omp teams  // expected-note {{nested teams construct here}}
4457     ++a;
4458   }
4459 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
4460   {
4461     while (0)      // expected-note {{statement outside teams construct here}}
4462 #pragma omp teams  // expected-note {{nested teams construct here}}
4463     ++a;
4464   }
4465 #pragma omp target
4466   {
4467 #pragma omp taskloop
4468   for (int i = 0; i < 10; ++i)
4469     ++a;
4470   }
4471 #pragma omp target
4472   {
4473 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
4474     for (int i = 0; i < 10; ++i)
4475       ;
4476   }
4477 #pragma omp target
4478   {
4479 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
4480   }
4481 #pragma omp target
4482   {
4483 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
4484   }
4485 #pragma omp target
4486   {
4487 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
4488   }
4489 #pragma omp target
4490   {
4491 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
4492     for (int i = 0; i < 10; ++i)
4493       ;
4494   }
4495 #pragma omp target
4496   {
4497 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
4498     for (int i = 0; i < 10; ++i)
4499       ;
4500   }
4501 #pragma omp target
4502   {
4503 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
4504     for (int i = 0; i < 10; ++i)
4505       ;
4506   }
4507 #pragma omp target
4508   {
4509 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
4510     for (int i = 0; i < 10; ++i)
4511       ;
4512   }
4513 #pragma omp target
4514   {
4515 #pragma omp teams distribute // OK
4516     for (int i = 0; i < 10; ++i)
4517       ;
4518   }
4519 #pragma omp target
4520   {
4521 #pragma omp teams distribute simd // OK
4522     for (int i = 0; i < 10; ++i)
4523       ;
4524   }
4525 #pragma omp target
4526   {
4527 #pragma omp teams distribute parallel for simd // OK
4528     for (int i = 0; i < 10; ++i)
4529       ;
4530   }
4531 #pragma omp target
4532   {
4533 #pragma omp teams distribute parallel for // OK
4534     for (int i = 0; i < 10; ++i)
4535       ;
4536   }
4537 #pragma omp target
4538   {
4539 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
4540     for (int i = 0; i < 10; ++i)
4541       ;
4542   }
4543 #pragma omp target
4544   {
4545 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
4546     for (int i = 0; i < 10; ++i)
4547       ;
4548   }
4549 #pragma omp target
4550   {
4551 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
4552     for (int i = 0; i < 10; ++i)
4553       ;
4554   }
4555 #pragma omp target
4556   {
4557 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
4558     for (int i = 0; i < 10; ++i)
4559       ;
4560   }
4561 #pragma omp target
4562   {
4563 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
4564     for (int i = 0; i < 10; ++i)
4565       ;
4566   }
4567 
4568 // TARGET PARALLEL DIRECTIVE
4569 #pragma omp target parallel
4570 #pragma omp parallel
4571   bar();
4572 #pragma omp target parallel
4573 #pragma omp for
4574   for (int i = 0; i < 10; ++i)
4575     ;
4576 #pragma omp target parallel
4577 #pragma omp simd
4578   for (int i = 0; i < 10; ++i)
4579     ;
4580 #pragma omp target parallel
4581 #pragma omp for simd
4582   for (int i = 0; i < 10; ++i)
4583     ;
4584 #pragma omp target parallel
4585 #pragma omp sections
4586   {
4587     bar();
4588   }
4589 #pragma omp target parallel
4590 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel region}}
4591   {
4592     bar();
4593   }
4594 #pragma omp target parallel
4595 #pragma omp single
4596   bar();
4597 
4598 #pragma omp target parallel
4599 #pragma omp master
4600   {
4601     bar();
4602   }
4603 #pragma omp target
4604 #pragma omp parallel master
4605   {
4606     bar();
4607   }
4608 #pragma omp target parallel
4609 #pragma omp critical
4610   {
4611     bar();
4612   }
4613 #pragma omp target parallel
4614 #pragma omp parallel for
4615   for (int i = 0; i < 10; ++i)
4616     ;
4617 #pragma omp target parallel
4618 #pragma omp parallel for simd
4619   for (int i = 0; i < 10; ++i)
4620     ;
4621 #pragma omp target parallel
4622 #pragma omp parallel sections
4623   {
4624     bar();
4625   }
4626 #pragma omp target parallel
4627 #pragma omp task
4628   {
4629     bar();
4630   }
4631 #pragma omp target parallel
4632   {
4633 #pragma omp taskyield
4634     bar();
4635   }
4636 #pragma omp target parallel
4637   {
4638 #pragma omp barrier
4639     bar();
4640   }
4641 #pragma omp target parallel
4642   {
4643 #pragma omp taskwait
4644     bar();
4645   }
4646 #pragma omp target parallel
4647   {
4648 #pragma omp flush
4649     bar();
4650   }
4651 #pragma omp target parallel
4652   {
4653 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
4654     bar();
4655   }
4656 #pragma omp target parallel
4657   {
4658 #pragma omp atomic
4659     ++a;
4660   }
4661 #pragma omp target parallel
4662   {
4663 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel' region}}
4664     ++a;
4665   }
4666 #pragma omp target parallel
4667   {
4668 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel' region}}
4669     ++a;
4670   }
4671 #pragma omp target parallel
4672 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel' region}}
4673   for (int i = 0; i < 10; ++i)
4674     ;
4675 #pragma omp target parallel
4676   {
4677 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
4678     ++a;
4679   }
4680 #pragma omp target parallel
4681   {
4682     ++a;
4683 #pragma omp teams  // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
4684     ++a;
4685   }
4686 #pragma omp target parallel
4687   {
4688 #pragma omp taskloop
4689   for (int i = 0; i < 10; ++i)
4690     ++a;
4691   }
4692 #pragma omp target parallel
4693   {
4694 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
4695     for (int i = 0; i < 10; ++i)
4696       ;
4697   }
4698 #pragma omp target parallel
4699   {
4700 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel' region}}
4701   }
4702 #pragma omp target parallel
4703   {
4704 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel' region}}
4705   }
4706 #pragma omp target parallel
4707   {
4708 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel' region}}
4709   }
4710 #pragma omp target parallel
4711   {
4712 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
4713     for (int i = 0; i < 10; ++i)
4714       ;
4715   }
4716 #pragma omp target parallel
4717   {
4718 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
4719     for (int i = 0; i < 10; ++i)
4720       ;
4721   }
4722 #pragma omp target parallel
4723   {
4724 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
4725     for (int i = 0; i < 10; ++i)
4726       ;
4727   }
4728 #pragma omp target parallel
4729   {
4730 #pragma omp target simd // expected-error {{region cannot be nested inside 'target parallel' region}}
4731     for (int i = 0; i < 10; ++i)
4732       ;
4733   }
4734 #pragma omp target parallel
4735   {
4736 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
4737     for (int i = 0; i < 10; ++i)
4738       ;
4739   }
4740 #pragma omp target parallel
4741   {
4742 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
4743     for (int i = 0; i < 10; ++i)
4744       ;
4745   }
4746 #pragma omp target parallel
4747   {
4748 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
4749     for (int i = 0; i < 10; ++i)
4750       ;
4751   }
4752 #pragma omp target parallel
4753   {
4754 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
4755     for (int i = 0; i < 10; ++i)
4756       ;
4757   }
4758 #pragma omp target parallel
4759   {
4760 #pragma omp target teams // expected-error {{region cannot be nested inside 'target parallel' region}}
4761     a++;
4762   }
4763 #pragma omp target parallel
4764   {
4765 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target parallel' region}}
4766     for (int i = 0; i < 10; ++i)
4767       ;
4768   }
4769 #pragma omp target parallel
4770   {
4771 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target parallel' region}}
4772     for (int i = 0; i < 10; ++i)
4773       ;
4774   }
4775 #pragma omp target parallel
4776   {
4777 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target parallel' region}}
4778     for (int i = 0; i < 10; ++i)
4779       ;
4780   }
4781 #pragma omp target parallel
4782   {
4783 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target parallel' region}}
4784     for (int i = 0; i < 10; ++i)
4785       ;
4786   }
4787 
4788 // TARGET PARALLEL FOR DIRECTIVE
4789 #pragma omp target parallel for
4790   for (int i = 0; i < 10; ++i) {
4791 #pragma omp for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
4792     for (int i = 0; i < 10; ++i)
4793       ;
4794   }
4795 #pragma omp target parallel for
4796   for (int i = 0; i < 10; ++i) {
4797 #pragma omp simd
4798     for (int i = 0; i < 10; ++i)
4799       ;
4800   }
4801 #pragma omp target parallel for
4802   for (int i = 0; i < 10; ++i) {
4803 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
4804     for (int i = 0; i < 10; ++i)
4805       ;
4806   }
4807 #pragma omp target parallel for
4808   for (int i = 0; i < 10; ++i) {
4809 #pragma omp parallel
4810     for (int i = 0; i < 10; ++i)
4811       ;
4812   }
4813 #pragma omp target parallel for
4814   for (int i = 0; i < 10; ++i) {
4815 #pragma omp sections // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
4816     {
4817       bar();
4818     }
4819   }
4820 #pragma omp target parallel for
4821   for (int i = 0; i < 10; ++i) {
4822 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel for region}}
4823     {
4824       bar();
4825     }
4826   }
4827 #pragma omp target parallel for
4828   for (int i = 0; i < 10; ++i) {
4829 #pragma omp single // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
4830     {
4831       bar();
4832     }
4833   }
4834 
4835 #pragma omp target parallel for
4836   for (int i = 0; i < 10; ++i) {
4837 #pragma omp master // expected-error {{region cannot be closely nested inside 'target parallel for' region}}
4838     {
4839       bar();
4840     }
4841   }
4842 
4843 #pragma omp target parallel for
4844   for (int i = 0; i < 10; ++i) {
4845 #pragma omp critical
4846     {
4847       bar();
4848     }
4849   }
4850 
4851 #pragma omp target parallel for
4852   for (int i = 0; i < 10; ++i) {
4853 #pragma omp parallel
4854     {
4855 #pragma omp single // OK
4856       {
4857         bar();
4858       }
4859 #pragma omp for // OK
4860       for (int i = 0; i < 10; ++i)
4861         ;
4862 #pragma omp for simd // OK
4863       for (int i = 0; i < 10; ++i)
4864         ;
4865 #pragma omp sections // OK
4866       {
4867         bar();
4868       }
4869     }
4870   }
4871 #pragma omp target parallel for
4872   for (int i = 0; i < 10; ++i) {
4873 #pragma omp parallel for
4874     for (int i = 0; i < 10; ++i)
4875       ;
4876   }
4877 #pragma omp target parallel for
4878   for (int i = 0; i < 10; ++i) {
4879 #pragma omp parallel for simd
4880     for (int i = 0; i < 10; ++i)
4881       ;
4882   }
4883 #pragma omp target parallel for
4884   for (int i = 0; i < 10; ++i) {
4885 #pragma omp parallel sections
4886     {
4887       bar();
4888     }
4889   }
4890 #pragma omp target parallel for
4891   for (int i = 0; i < 10; ++i) {
4892 #pragma omp task
4893     {
4894       bar();
4895     }
4896   }
4897 #pragma omp target parallel for
4898   for (int i = 0; i < 10; ++i) {
4899 #pragma omp taskyield
4900     bar();
4901   }
4902 #pragma omp target parallel for
4903   for (int i = 0; i < 10; ++i) {
4904 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target parallel for' region}}
4905     bar();
4906   }
4907 #pragma omp target parallel for
4908   for (int i = 0; i < 10; ++i) {
4909 #pragma omp taskwait
4910     bar();
4911   }
4912 #pragma omp target parallel for
4913   for (int i = 0; i < 10; ++i) {
4914 #pragma omp flush
4915     bar();
4916   }
4917 #pragma omp target parallel for
4918   for (int i = 0; i < 10; ++i) {
4919 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
4920     bar();
4921   }
4922 #pragma omp target parallel for ordered
4923   for (int i = 0; i < 10; ++i) {
4924 #pragma omp ordered // OK
4925     bar();
4926   }
4927 #pragma omp target parallel for
4928   for (int i = 0; i < 10; ++i) {
4929 #pragma omp atomic
4930     ++a;
4931   }
4932 #pragma omp target parallel for
4933   for (int i = 0; i < 10; ++i) {
4934 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel for' region}}
4935     ++a;
4936   }
4937 #pragma omp target parallel for
4938   for (int i = 0; i < 10; ++i) {
4939 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel for' region}}
4940     ++a;
4941   }
4942 #pragma omp target parallel for
4943   for (int i = 0; i < 10; ++i) {
4944 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}}
4945     for (int i = 0; i < 10; ++i)
4946       ;
4947   }
4948 #pragma omp target parallel for
4949   for (int i = 0; i < 10; ++i) {
4950 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
4951     ++a;
4952   }
4953 #pragma omp target parallel for
4954   for (int i = 0; i < 10; ++i) {
4955 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
4956     ++a;
4957   }
4958 #pragma omp target parallel for
4959   for (int i = 0; i < 10; ++i) {
4960 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
4961     ++a;
4962   }
4963 #pragma omp target parallel for
4964   for (int i = 0; i < 10; ++i) {
4965 #pragma omp taskloop
4966   for (int i = 0; i < 10; ++i)
4967     ++a;
4968   }
4969 #pragma omp target parallel for
4970   for (int i = 0; i < 10; ++i) {
4971 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
4972     for (int j = 0; j < 10; ++j)
4973       ;
4974   }
4975 #pragma omp target parallel for
4976   for (int i = 0; i < 10; ++i) {
4977 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
4978   }
4979 #pragma omp target parallel for
4980   for (int i = 0; i < 10; ++i) {
4981 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
4982     for (int j = 0; j < 10; ++j)
4983       ;
4984   }
4985 #pragma omp target parallel for
4986   for (int i = 0; i < 10; ++i) {
4987 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
4988     for (int j = 0; j < 10; ++j)
4989       ;
4990   }
4991 #pragma omp target parallel for
4992   for (int i = 0; i < 10; ++i) {
4993 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
4994     for (int j = 0; j < 10; ++j)
4995       ;
4996   }
4997 #pragma omp target parallel for
4998   for (int i = 0; i < 10; ++i) {
4999 #pragma omp target simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
5000     for (int j = 0; j < 10; ++j)
5001       ;
5002   }
5003 #pragma omp target parallel for
5004   for (int i = 0; i < 10; ++i) {
5005 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
5006     for (int j = 0; j < 10; ++j)
5007       ;
5008   }
5009 #pragma omp target parallel for
5010   for (int i = 0; i < 10; ++i) {
5011 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
5012     for (int j = 0; j < 10; ++j)
5013       ;
5014   }
5015 #pragma omp target parallel for
5016   for (int i = 0; i < 10; ++i) {
5017 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
5018     for (int j = 0; j < 10; ++j)
5019       ;
5020   }
5021 #pragma omp target parallel for
5022   for (int i = 0; i < 10; ++i) {
5023 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
5024     for (int j = 0; j < 10; ++j)
5025       ;
5026   }
5027 #pragma omp target parallel for
5028   for (int i = 0; i < 10; ++i) {
5029 #pragma omp target teams // expected-error {{region cannot be nested inside 'target parallel for' region}}
5030     a++;
5031   }
5032 #pragma omp target parallel for
5033   for (int i = 0; i < 10; ++i) {
5034 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target parallel for' region}}
5035     for (int j = 0; j < 10; ++j)
5036       ;
5037   }
5038 #pragma omp target parallel for
5039   for (int i = 0; i < 10; ++i) {
5040 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}}
5041     for (int j = 0; j < 10; ++j)
5042       ;
5043   }
5044 #pragma omp target parallel for
5045   for (int i = 0; i < 10; ++i) {
5046 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
5047     for (int j = 0; j < 10; ++j)
5048       ;
5049   }
5050 #pragma omp target parallel for
5051   for (int i = 0; i < 10; ++i) {
5052 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
5053     for (int j = 0; j < 10; ++j)
5054       ;
5055   }
5056 
5057 // TEAMS DIRECTIVE
5058 #pragma omp teams // omp45-error {{orphaned 'omp teams' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
5059   bar();
5060 #pragma omp target
5061 #pragma omp teams
5062 #pragma omp parallel
5063   bar();
5064 #pragma omp target
5065 #pragma omp teams
5066 #pragma omp for // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
5067   for (int i = 0; i < 10; ++i)
5068     ;
5069 #pragma omp target
5070 #pragma omp teams
5071 #pragma omp simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp simd' directive into a parallel region?}}
5072   for (int i = 0; i < 10; ++i)
5073     ;
5074 #pragma omp target
5075 #pragma omp teams
5076 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
5077   for (int i = 0; i < 10; ++i)
5078     ;
5079 #pragma omp target
5080 #pragma omp teams
5081 #pragma omp sections // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
5082   {
5083     bar();
5084   }
5085 #pragma omp target
5086 #pragma omp teams
5087 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams region}}
5088   {
5089     bar();
5090   }
5091 #pragma omp target
5092 #pragma omp teams
5093 #pragma omp single // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
5094   bar();
5095 
5096 #pragma omp target
5097 #pragma omp teams
5098 #pragma omp master // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp master' directive into a parallel region?}}
5099   {
5100     bar();
5101   }
5102 #pragma omp target
5103 #pragma omp teams
5104 #pragma omp critical // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp critical' directive into a parallel region?}}
5105   {
5106     bar();
5107   }
5108 #pragma omp target
5109 #pragma omp teams
5110 #pragma omp parallel for
5111   for (int i = 0; i < 10; ++i)
5112     ;
5113 #pragma omp target
5114 #pragma omp teams
5115 #pragma omp parallel for simd
5116   for (int i = 0; i < 10; ++i)
5117     ;
5118 #pragma omp target
5119 #pragma omp teams
5120 #pragma omp parallel sections
5121   {
5122     bar();
5123   }
5124 #pragma omp target
5125 #pragma omp teams
5126 #pragma omp task // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp task' directive into a parallel region?}}
5127   {
5128     bar();
5129   }
5130 #pragma omp target
5131 #pragma omp teams
5132   {
5133 #pragma omp taskyield // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskyield' directive into a parallel region?}}
5134     bar();
5135   }
5136 #pragma omp target
5137 #pragma omp teams
5138   {
5139 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp barrier' directive into a parallel region?}}
5140     bar();
5141   }
5142 #pragma omp target
5143 #pragma omp teams
5144   {
5145 #pragma omp taskwait // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskwait' directive into a parallel region?}}
5146     bar();
5147   }
5148 #pragma omp target
5149 #pragma omp teams
5150   {
5151 #pragma omp flush // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp flush' directive into a parallel region?}}
5152     bar();
5153   }
5154 #pragma omp target
5155 #pragma omp teams
5156   {
5157 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
5158     bar();
5159   }
5160 #pragma omp target
5161 #pragma omp teams
5162   {
5163 #pragma omp atomic // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp atomic' directive into a parallel region?}}
5164     ++a;
5165   }
5166 #pragma omp target
5167 #pragma omp teams
5168   {
5169 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
5170     ++a;
5171   }
5172 #pragma omp target
5173 #pragma omp teams
5174   {
5175 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
5176     ++a;
5177   }
5178 #pragma omp target
5179 #pragma omp teams
5180 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
5181   for (int i = 0; i < 10; ++i)
5182     ;
5183 #pragma omp target
5184 #pragma omp teams
5185   {
5186 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
5187     ++a;
5188   }
5189 #pragma omp target
5190 #pragma omp teams
5191   {
5192 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
5193     ++a;
5194   }
5195 #pragma omp target
5196 #pragma omp teams
5197   {
5198 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
5199     ++a;
5200   }
5201 #pragma omp target
5202 #pragma omp teams
5203   {
5204 #pragma omp taskloop // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskloop' directive into a parallel region?}}
5205   for (int i = 0; i < 10; ++i)
5206     ++a;
5207   }
5208 #pragma omp target
5209 #pragma omp teams
5210 #pragma omp distribute
5211   for (int i = 0; i < 10; ++i)
5212     ;
5213 #pragma omp target
5214 #pragma omp teams
5215 #pragma omp distribute
5216   for (int i = 0; i < 10; ++i)
5217     ;
5218 #pragma omp distribute
5219   for (int j = 0; j < 10; ++j)
5220     ;
5221 #pragma omp target
5222 #pragma omp teams
5223   {
5224 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
5225   }
5226 #pragma omp target
5227 #pragma omp teams
5228   {
5229 #pragma omp distribute parallel for
5230   for (int i = 0; i < 10; ++i)
5231     ;
5232 #pragma omp distribute parallel for
5233   for (int j = 0; j < 10; ++j)
5234     ;
5235   }
5236 #pragma omp target
5237 #pragma omp teams
5238   {
5239 #pragma omp distribute parallel for simd
5240   for (int i = 0; i < 10; ++i)
5241     ;
5242 #pragma omp distribute parallel for simd
5243   for (int j = 0; j < 10; ++j)
5244     ;
5245   }
5246 #pragma omp target
5247 #pragma omp teams
5248   {
5249 #pragma omp distribute simd
5250   for (int i = 0; i < 10; ++i)
5251     ;
5252 #pragma omp distribute simd
5253   for (int j = 0; j < 10; ++j)
5254     ;
5255   }
5256 #pragma omp target
5257 #pragma omp teams
5258   {
5259 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
5260   for (int i = 0; i < 10; ++i)
5261     ;
5262   }
5263 #pragma omp target
5264 #pragma omp teams
5265   {
5266 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
5267   for (int i = 0; i < 10; ++i)
5268     ;
5269   }
5270 #pragma omp target
5271 #pragma omp teams
5272   {
5273 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
5274   for (int i = 0; i < 10; ++i)
5275     ;
5276   }
5277 #pragma omp target
5278 #pragma omp teams
5279   {
5280 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
5281   for (int i = 0; i < 10; ++i)
5282     ;
5283   }
5284 #pragma omp target
5285 #pragma omp teams
5286   {
5287 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
5288   for (int i = 0; i < 10; ++i)
5289     ;
5290   }
5291 #pragma omp target
5292 #pragma omp teams
5293   {
5294 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
5295     a++;
5296   }
5297 #pragma omp target
5298 #pragma omp teams
5299   {
5300 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
5301   for (int i = 0; i < 10; ++i)
5302     ;
5303   }
5304 #pragma omp target
5305 #pragma omp teams
5306   {
5307 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
5308   for (int i = 0; i < 10; ++i)
5309     ;
5310   }
5311 #pragma omp target
5312 #pragma omp teams
5313   {
5314 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
5315   for (int i = 0; i < 10; ++i)
5316     ;
5317   }
5318 #pragma omp target
5319 #pragma omp teams
5320   {
5321 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
5322   for (int i = 0; i < 10; ++i)
5323     ;
5324   }
5325 
5326 // TASKLOOP DIRECTIVE
5327 #pragma omp taskloop
5328   for (int i = 0; i < 10; ++i) {
5329 #pragma omp for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
5330     for (int i = 0; i < 10; ++i)
5331       ;
5332   }
5333 #pragma omp taskloop
5334   for (int i = 0; i < 10; ++i) {
5335 #pragma omp simd
5336     for (int i = 0; i < 10; ++i)
5337       ;
5338   }
5339 #pragma omp taskloop
5340   for (int i = 0; i < 10; ++i) {
5341 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
5342     for (int i = 0; i < 10; ++i)
5343       ;
5344   }
5345 #pragma omp taskloop
5346   for (int i = 0; i < 10; ++i) {
5347 #pragma omp parallel
5348     for (int i = 0; i < 10; ++i)
5349       ;
5350   }
5351 #pragma omp taskloop
5352   for (int i = 0; i < 10; ++i) {
5353 #pragma omp sections // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
5354     {
5355       bar();
5356     }
5357   }
5358 #pragma omp taskloop
5359   for (int i = 0; i < 10; ++i) {
5360 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a taskloop region}}
5361     {
5362       bar();
5363     }
5364   }
5365 #pragma omp taskloop
5366   for (int i = 0; i < 10; ++i) {
5367 #pragma omp single // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
5368     {
5369       bar();
5370     }
5371   }
5372 
5373 #pragma omp taskloop
5374   for (int i = 0; i < 10; ++i) {
5375 #pragma omp master // expected-error {{region cannot be closely nested inside 'taskloop' region}}
5376     {
5377       bar();
5378     }
5379   }
5380 #pragma omp taskloop
5381   for (int i = 0; i < 10; ++i) {
5382 #pragma omp critical
5383     {
5384       bar();
5385     }
5386   }
5387 #pragma omp taskloop
5388   for (int i = 0; i < 10; ++i) {
5389 #pragma omp parallel
5390     {
5391 #pragma omp single // OK
5392       {
5393         bar();
5394       }
5395 #pragma omp for // OK
5396       for (int i = 0; i < 10; ++i)
5397         ;
5398 #pragma omp sections // OK
5399       {
5400         bar();
5401       }
5402     }
5403   }
5404 #pragma omp taskloop
5405   for (int i = 0; i < 10; ++i) {
5406 #pragma omp parallel for
5407     for (int i = 0; i < 10; ++i)
5408       ;
5409   }
5410 #pragma omp taskloop
5411   for (int i = 0; i < 10; ++i) {
5412 #pragma omp parallel for simd
5413     for (int i = 0; i < 10; ++i)
5414       ;
5415   }
5416 #pragma omp taskloop
5417   for (int i = 0; i < 10; ++i) {
5418 #pragma omp parallel sections
5419     {
5420       bar();
5421     }
5422   }
5423 #pragma omp taskloop
5424   for (int i = 0; i < 10; ++i) {
5425 #pragma omp task
5426     {
5427       bar();
5428     }
5429   }
5430 #pragma omp taskloop
5431   for (int i = 0; i < 10; ++i) {
5432 #pragma omp taskyield
5433     bar();
5434   }
5435 #pragma omp taskloop
5436   for (int i = 0; i < 10; ++i) {
5437 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'taskloop' region}}
5438     bar();
5439   }
5440 #pragma omp taskloop
5441   for (int i = 0; i < 10; ++i) {
5442 #pragma omp taskwait
5443     bar();
5444   }
5445 #pragma omp taskloop
5446   for (int i = 0; i < 10; ++i) {
5447 #pragma omp flush
5448     bar();
5449   }
5450 #pragma omp taskloop
5451   for (int i = 0; i < 10; ++i) {
5452 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
5453     bar();
5454   }
5455 #pragma omp taskloop
5456   for (int i = 0; i < 10; ++i) {
5457 #pragma omp atomic
5458     ++a;
5459   }
5460 #pragma omp taskloop
5461   for (int i = 0; i < 10; ++i) {
5462 #pragma omp target
5463     ++a;
5464   }
5465 #pragma omp taskloop
5466   for (int i = 0; i < 10; ++i) {
5467 #pragma omp target parallel
5468     ++a;
5469   }
5470 #pragma omp taskloop
5471   for (int i = 0; i < 10; ++i) {
5472 #pragma omp target parallel for
5473     for (int i = 0; i < 10; ++i)
5474       ;
5475   }
5476 #pragma omp taskloop
5477   for (int i = 0; i < 10; ++i) {
5478 #pragma omp target enter data map(to: a)
5479     ++a;
5480   }
5481 #pragma omp taskloop
5482   for (int i = 0; i < 10; ++i) {
5483 #pragma omp target exit data map(from: a)
5484     ++a;
5485   }
5486 #pragma omp taskloop
5487   for (int i = 0; i < 10; ++i) {
5488 #pragma omp teams // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
5489     ++a;
5490   }
5491 #pragma omp taskloop
5492   for (int i = 0; i < 10; ++i) {
5493 #pragma omp taskloop
5494   for (int i = 0; i < 10; ++i)
5495     ++a;
5496   }
5497 #pragma omp taskloop
5498   for (int i = 0; i < 10; ++i) {
5499 #pragma omp target update to(a)
5500     bar();
5501   }
5502 #pragma omp taskloop
5503   for (int i = 0; i < 10; ++i) {
5504 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
5505   for (int j = 0; j < 10; ++j)
5506     ++a;
5507   }
5508 #pragma omp taskloop
5509   for (int i = 0; i < 10; ++i) {
5510 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
5511   for (int j = 0; j < 10; ++j)
5512     ++a;
5513   }
5514 #pragma omp taskloop
5515   for (int i = 0; i < 10; ++i) {
5516 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
5517   for (int j = 0; j < 10; ++j)
5518     ++a;
5519   }
5520 #pragma omp taskloop
5521   for (int i = 0; i < 10; ++i) {
5522 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
5523   for (int j = 0; j < 10; ++j)
5524     ++a;
5525   }
5526 #pragma omp taskloop
5527   for (int i = 0; i < 10; ++i) {
5528 #pragma omp target simd // OK
5529   for (int j = 0; j < 10; ++j)
5530     ++a;
5531   }
5532 #pragma omp taskloop
5533   for (int i = 0; i < 10; ++i) {
5534 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
5535   for (int j = 0; j < 10; ++j)
5536     ++a;
5537   }
5538 #pragma omp taskloop
5539   for (int i = 0; i < 10; ++i) {
5540 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
5541   for (int j = 0; j < 10; ++j)
5542     ++a;
5543   }
5544 #pragma omp taskloop
5545   for (int i = 0; i < 10; ++i) {
5546 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
5547   for (int j = 0; j < 10; ++j)
5548     ++a;
5549   }
5550 #pragma omp taskloop
5551   for (int i = 0; i < 10; ++i) {
5552 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
5553   for (int j = 0; j < 10; ++j)
5554     ++a;
5555   }
5556 #pragma omp taskloop
5557   for (int i = 0; i < 10; ++i) {
5558 #pragma omp target teams // OK
5559     ++a;
5560   }
5561 #pragma omp taskloop
5562   for (int i = 0; i < 10; ++i) {
5563 #pragma omp target teams distribute // OK
5564   for (int j = 0; j < 10; ++j)
5565     ++a;
5566   }
5567 #pragma omp taskloop
5568   for (int i = 0; i < 10; ++i) {
5569 #pragma omp target teams distribute parallel for // OK
5570   for (int j = 0; j < 10; ++j)
5571     ++a;
5572   }
5573 #pragma omp taskloop
5574   for (int i = 0; i < 10; ++i) {
5575 #pragma omp target teams distribute parallel for simd // OK
5576   for (int j = 0; j < 10; ++j)
5577     ++a;
5578   }
5579 #pragma omp taskloop
5580   for (int i = 0; i < 10; ++i) {
5581 #pragma omp target teams distribute simd // OK
5582   for (int j = 0; j < 10; ++j)
5583     ++a;
5584   }
5585 
5586 // DISTRIBUTE DIRECTIVE
5587 #pragma omp target
5588 #pragma omp teams
5589 #pragma omp distribute
5590   for (int i = 0; i < 10; ++i) {
5591 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
5592     for (int i = 0; i < 10; ++i)
5593       ;
5594   }
5595 #pragma omp target
5596 #pragma omp teams
5597 #pragma omp distribute
5598   for (int i = 0; i < 10; ++i) {
5599 #pragma omp for
5600     for (int i = 0; i < 10; ++i)
5601       ;
5602   }
5603 #pragma omp target
5604 #pragma omp teams
5605 #pragma omp distribute
5606   for (int i = 0; i < 10; ++i) {
5607 #pragma omp simd
5608     for (int i = 0; i < 10; ++i)
5609       ;
5610   }
5611 #pragma omp target
5612 #pragma omp teams
5613 #pragma omp distribute
5614   for (int i = 0; i < 10; ++i) {
5615 #pragma omp for simd
5616     for (int i = 0; i < 10; ++i)
5617       ;
5618   }
5619 #pragma omp target
5620 #pragma omp teams
5621 #pragma omp distribute
5622   for (int i = 0; i < 10; ++i) {
5623 #pragma omp parallel
5624     for (int i = 0; i < 10; ++i)
5625       ;
5626   }
5627 #pragma omp target
5628 #pragma omp teams
5629 #pragma omp distribute
5630   for (int i = 0; i < 10; ++i) {
5631 #pragma omp sections
5632     {
5633       bar();
5634     }
5635   }
5636 #pragma omp target
5637 #pragma omp teams
5638 #pragma omp distribute
5639   for (int i = 0; i < 10; ++i) {
5640 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute region}}
5641     {
5642       bar();
5643     }
5644   }
5645 #pragma omp target
5646 #pragma omp teams
5647 #pragma omp distribute
5648   for (int i = 0; i < 10; ++i) {
5649 #pragma omp single
5650     {
5651       bar();
5652     }
5653   }
5654 #pragma omp target
5655 #pragma omp teams
5656 #pragma omp distribute
5657   for (int i = 0; i < 10; ++i) {
5658 #pragma omp master
5659     {
5660       bar();
5661     }
5662   }
5663 #pragma omp target
5664 #pragma omp teams
5665 #pragma omp distribute
5666   for (int i = 0; i < 10; ++i) {
5667 #pragma omp critical
5668     {
5669       bar();
5670     }
5671   }
5672 #pragma omp target
5673 #pragma omp teams
5674 #pragma omp distribute
5675   for (int i = 0; i < 10; ++i) {
5676 #pragma omp parallel
5677     {
5678 #pragma omp single
5679       {
5680         bar();
5681       }
5682     }
5683   }
5684 #pragma omp target
5685 #pragma omp teams
5686 #pragma omp distribute
5687   for (int i = 0; i < 10; ++i) {
5688 #pragma omp parallel for
5689     for (int i = 0; i < 10; ++i)
5690       ;
5691   }
5692 #pragma omp target
5693 #pragma omp teams
5694 #pragma omp distribute
5695   for (int i = 0; i < 10; ++i) {
5696 #pragma omp parallel for simd
5697     for (int i = 0; i < 10; ++i)
5698       ;
5699   }
5700 #pragma omp target
5701 #pragma omp teams
5702 #pragma omp distribute
5703   for (int i = 0; i < 10; ++i) {
5704 #pragma omp parallel sections
5705     {
5706       bar();
5707     }
5708   }
5709 #pragma omp target
5710 #pragma omp teams
5711 #pragma omp distribute
5712   for (int i = 0; i < 10; ++i) {
5713 #pragma omp task
5714     {
5715       bar();
5716     }
5717   }
5718 #pragma omp target
5719 #pragma omp teams
5720 #pragma omp distribute
5721   for (int i = 0; i < 10; ++i) {
5722 #pragma omp taskyield
5723     bar();
5724   }
5725 #pragma omp target
5726 #pragma omp teams
5727 #pragma omp distribute
5728   for (int i = 0; i < 10; ++i) {
5729 #pragma omp barrier
5730     bar();
5731   }
5732 #pragma omp target
5733 #pragma omp teams
5734 #pragma omp distribute
5735   for (int i = 0; i < 10; ++i) {
5736 #pragma omp taskwait
5737     bar();
5738   }
5739 #pragma omp target
5740 #pragma omp teams
5741 #pragma omp distribute
5742   for (int i = 0; i < 10; ++i) {
5743 #pragma omp flush
5744     bar();
5745   }
5746 #pragma omp target
5747 #pragma omp teams
5748 #pragma omp distribute
5749   for (int i = 0; i < 10; ++i) {
5750 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
5751     bar();
5752   }
5753 #pragma omp target
5754 #pragma omp teams
5755 #pragma omp distribute
5756   for (int i = 0; i < 10; ++i) {
5757 #pragma omp atomic
5758     ++a;
5759   }
5760 #pragma omp target
5761 #pragma omp teams
5762 #pragma omp distribute
5763   for (int i = 0; i < 10; ++i) {
5764 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
5765     ++a;
5766   }
5767 #pragma omp target
5768 #pragma omp teams
5769 #pragma omp distribute
5770   for (int i = 0; i < 10; ++i) {
5771 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
5772     ++a;
5773   }
5774 #pragma omp target
5775 #pragma omp teams
5776 #pragma omp distribute
5777   for (int i = 0; i < 10; ++i) {
5778 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
5779     for (int i = 0; i < 10; ++i)
5780       ;
5781   }
5782 #pragma omp target
5783 #pragma omp teams
5784 #pragma omp distribute
5785   for (int i = 0; i < 10; ++i) {
5786 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
5787     ++a;
5788   }
5789 #pragma omp target
5790 #pragma omp teams
5791 #pragma omp distribute
5792   for (int i = 0; i < 10; ++i) {
5793 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
5794     ++a;
5795   }
5796 #pragma omp target
5797 #pragma omp teams
5798 #pragma omp distribute
5799   for (int i = 0; i < 10; ++i) {
5800 #pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
5801     ++a;
5802   }
5803 #pragma omp target
5804 #pragma omp teams
5805 #pragma omp distribute
5806   for (int i = 0; i < 10; ++i) {
5807 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
5808     ++a;
5809   }
5810 #pragma omp target
5811 #pragma omp teams
5812 #pragma omp distribute
5813   for (int i = 0; i < 10; ++i) {
5814 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
5815     for (int j = 0; j < 10; ++j)
5816       ;
5817   }
5818 #pragma omp target
5819 #pragma omp teams
5820 #pragma omp distribute
5821   for (int i = 0; i < 10; ++i) {
5822 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
5823     for (int j = 0; j < 10; ++j)
5824       ;
5825   }
5826 #pragma omp target
5827 #pragma omp teams
5828 #pragma omp distribute
5829   for (int i = 0; i < 10; ++i) {
5830 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
5831     for (int j = 0; j < 10; ++j)
5832       ;
5833   }
5834 #pragma omp target
5835 #pragma omp teams
5836 #pragma omp distribute
5837   for (int i = 0; i < 10; ++i) {
5838 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
5839     for (int j = 0; j < 10; ++j)
5840       ;
5841   }
5842 #pragma omp target
5843 #pragma omp teams
5844 #pragma omp distribute
5845   for (int i = 0; i < 10; ++i) {
5846 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
5847     for (int j = 0; j < 10; ++j)
5848       ;
5849   }
5850 #pragma omp target
5851 #pragma omp teams
5852 #pragma omp distribute
5853   for (int i = 0; i < 10; ++i) {
5854 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
5855     a++;
5856   }
5857 #pragma omp target
5858 #pragma omp teams
5859 #pragma omp distribute
5860   for (int i = 0; i < 10; ++i) {
5861 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
5862     for (int j = 0; j < 10; ++j)
5863       ;
5864   }
5865 #pragma omp target
5866 #pragma omp teams
5867 #pragma omp distribute
5868   for (int i = 0; i < 10; ++i) {
5869 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
5870     for (int j = 0; j < 10; ++j)
5871       ;
5872   }
5873 #pragma omp target
5874 #pragma omp teams
5875 #pragma omp distribute
5876   for (int i = 0; i < 10; ++i) {
5877 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
5878     for (int j = 0; j < 10; ++j)
5879       ;
5880   }
5881 #pragma omp target
5882 #pragma omp teams
5883 #pragma omp distribute
5884   for (int i = 0; i < 10; ++i) {
5885 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
5886     for (int j = 0; j < 10; ++j)
5887       ;
5888   }
5889 
5890 // DISTRIBUTE PARALLEL FOR DIRECTIVE
5891 #pragma omp target
5892 #pragma omp teams
5893 #pragma omp distribute parallel for
5894   for (int i = 0; i < 10; ++i) {
5895 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
5896     for (int i = 0; i < 10; ++i)
5897       ;
5898   }
5899 #pragma omp target
5900 #pragma omp teams
5901 #pragma omp distribute parallel for
5902   for (int i = 0; i < 10; ++i) {
5903 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
5904     for (int i = 0; i < 10; ++i)
5905       ;
5906   }
5907 #pragma omp target
5908 #pragma omp teams
5909 #pragma omp distribute parallel for
5910   for (int i = 0; i < 10; ++i) {
5911 #pragma omp for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
5912     for (int i = 0; i < 10; ++i)
5913       ;
5914   }
5915 #pragma omp target
5916 #pragma omp teams
5917 #pragma omp distribute parallel for
5918   for (int i = 0; i < 10; ++i) {
5919 #pragma omp simd
5920     for (int i = 0; i < 10; ++i)
5921       ;
5922   }
5923 #pragma omp target
5924 #pragma omp teams
5925 #pragma omp distribute parallel for
5926   for (int i = 0; i < 10; ++i) {
5927 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
5928     for (int i = 0; i < 10; ++i)
5929       ;
5930   }
5931 #pragma omp target
5932 #pragma omp teams
5933 #pragma omp distribute parallel for
5934   for (int i = 0; i < 10; ++i) {
5935 #pragma omp parallel
5936     for (int i = 0; i < 10; ++i)
5937       ;
5938   }
5939 #pragma omp target
5940 #pragma omp teams
5941 #pragma omp distribute parallel for
5942   for (int i = 0; i < 10; ++i) {
5943 #pragma omp sections // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
5944     {
5945       bar();
5946     }
5947   }
5948 #pragma omp target
5949 #pragma omp teams
5950 #pragma omp distribute parallel for
5951   for (int i = 0; i < 10; ++i) {
5952 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute parallel for region}}
5953     {
5954       bar();
5955     }
5956   }
5957 #pragma omp target
5958 #pragma omp teams
5959 #pragma omp distribute parallel for
5960   for (int i = 0; i < 10; ++i) {
5961 #pragma omp single // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
5962     {
5963       bar();
5964     }
5965   }
5966 #pragma omp target
5967 #pragma omp teams
5968 #pragma omp distribute parallel for
5969   for (int i = 0; i < 10; ++i) {
5970 #pragma omp master // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}}
5971     {
5972       bar();
5973     }
5974   }
5975 #pragma omp target
5976 #pragma omp teams
5977 #pragma omp distribute parallel for
5978   for (int i = 0; i < 10; ++i) {
5979 #pragma omp critical
5980     {
5981       bar();
5982     }
5983   }
5984 #pragma omp target
5985 #pragma omp teams
5986 #pragma omp distribute parallel for
5987   for (int i = 0; i < 10; ++i) {
5988 #pragma omp parallel
5989     {
5990 #pragma omp single
5991       {
5992         bar();
5993       }
5994     }
5995   }
5996 #pragma omp target
5997 #pragma omp teams
5998 #pragma omp distribute parallel for
5999   for (int i = 0; i < 10; ++i) {
6000 #pragma omp parallel for
6001     for (int i = 0; i < 10; ++i)
6002       ;
6003   }
6004 #pragma omp target
6005 #pragma omp teams
6006 #pragma omp distribute parallel for
6007   for (int i = 0; i < 10; ++i) {
6008 #pragma omp parallel for simd
6009     for (int i = 0; i < 10; ++i)
6010       ;
6011   }
6012 #pragma omp target
6013 #pragma omp teams
6014 #pragma omp distribute parallel for
6015   for (int i = 0; i < 10; ++i) {
6016 #pragma omp parallel sections
6017     {
6018       bar();
6019     }
6020   }
6021 #pragma omp target
6022 #pragma omp teams
6023 #pragma omp distribute parallel for
6024   for (int i = 0; i < 10; ++i) {
6025 #pragma omp task
6026     {
6027       bar();
6028     }
6029   }
6030 #pragma omp target
6031 #pragma omp teams
6032 #pragma omp distribute parallel for
6033   for (int i = 0; i < 10; ++i) {
6034 #pragma omp taskyield
6035     bar();
6036   }
6037 #pragma omp target
6038 #pragma omp teams
6039 #pragma omp distribute parallel for
6040   for (int i = 0; i < 10; ++i) {
6041 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}}
6042     bar();
6043   }
6044 #pragma omp target
6045 #pragma omp teams
6046 #pragma omp distribute parallel for
6047   for (int i = 0; i < 10; ++i) {
6048 #pragma omp taskwait
6049     bar();
6050   }
6051 #pragma omp target
6052 #pragma omp teams
6053 #pragma omp distribute parallel for
6054   for (int i = 0; i < 10; ++i) {
6055 #pragma omp flush
6056     bar();
6057   }
6058 #pragma omp target
6059 #pragma omp teams
6060 #pragma omp distribute parallel for
6061   for (int i = 0; i < 10; ++i) {
6062 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
6063     bar();
6064   }
6065 #pragma omp target
6066 #pragma omp teams
6067 #pragma omp distribute parallel for
6068   for (int i = 0; i < 10; ++i) {
6069 #pragma omp atomic
6070     ++a;
6071   }
6072 #pragma omp target
6073 #pragma omp teams
6074 #pragma omp distribute parallel for
6075   for (int i = 0; i < 10; ++i) {
6076 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
6077     ++a;
6078   }
6079 #pragma omp target
6080 #pragma omp teams
6081 #pragma omp distribute parallel for
6082   for (int i = 0; i < 10; ++i) {
6083 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
6084     ++a;
6085   }
6086 #pragma omp target
6087 #pragma omp teams
6088 #pragma omp distribute parallel for
6089   for (int i = 0; i < 10; ++i) {
6090 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
6091     for (int i = 0; i < 10; ++i)
6092       ;
6093   }
6094 #pragma omp target
6095 #pragma omp teams
6096 #pragma omp distribute parallel for
6097   for (int i = 0; i < 10; ++i) {
6098 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
6099     ++a;
6100   }
6101 #pragma omp target
6102 #pragma omp teams
6103 #pragma omp distribute parallel for
6104   for (int i = 0; i < 10; ++i) {
6105 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
6106     ++a;
6107   }
6108 #pragma omp target
6109 #pragma omp teams
6110 #pragma omp distribute parallel for
6111   for (int i = 0; i < 10; ++i) {
6112 #pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
6113     ++a;
6114   }
6115 #pragma omp target
6116 #pragma omp teams
6117 #pragma omp distribute parallel for
6118   for (int i = 0; i < 10; ++i) {
6119 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
6120     ++a;
6121   }
6122 #pragma omp target
6123 #pragma omp teams
6124 #pragma omp distribute parallel for
6125   for (int i = 0; i < 10; ++i) {
6126 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
6127     for (int i = 0; i < 10; ++i)
6128       ;
6129   }
6130 #pragma omp target
6131 #pragma omp teams
6132 #pragma omp distribute parallel for
6133   for (int i = 0; i < 10; ++i) {
6134 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
6135     for (int i = 0; i < 10; ++i)
6136       ;
6137   }
6138 #pragma omp target
6139 #pragma omp teams
6140 #pragma omp distribute parallel for
6141   for (int i = 0; i < 10; ++i) {
6142 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
6143     for (int i = 0; i < 10; ++i)
6144       ;
6145   }
6146 #pragma omp target
6147 #pragma omp teams
6148 #pragma omp distribute parallel for
6149   for (int i = 0; i < 10; ++i) {
6150 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
6151     for (int i = 0; i < 10; ++i)
6152       ;
6153   }
6154 #pragma omp target
6155 #pragma omp teams
6156 #pragma omp distribute parallel for
6157   for (int i = 0; i < 10; ++i) {
6158 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
6159     for (int i = 0; i < 10; ++i)
6160       ;
6161   }
6162 #pragma omp target
6163 #pragma omp teams
6164 #pragma omp distribute parallel for
6165   for (int i = 0; i < 10; ++i) {
6166 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
6167     a++;
6168   }
6169 #pragma omp target
6170 #pragma omp teams
6171 #pragma omp distribute parallel for
6172   for (int i = 0; i < 10; ++i) {
6173 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
6174     for (int i = 0; i < 10; ++i)
6175       ;
6176   }
6177 #pragma omp target
6178 #pragma omp teams
6179 #pragma omp distribute parallel for
6180   for (int i = 0; i < 10; ++i) {
6181 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
6182     for (int i = 0; i < 10; ++i)
6183       ;
6184   }
6185 #pragma omp target
6186 #pragma omp teams
6187 #pragma omp distribute parallel for
6188   for (int i = 0; i < 10; ++i) {
6189 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
6190     for (int i = 0; i < 10; ++i)
6191       ;
6192   }
6193 #pragma omp target
6194 #pragma omp teams
6195 #pragma omp distribute parallel for
6196   for (int i = 0; i < 10; ++i) {
6197 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
6198     for (int i = 0; i < 10; ++i)
6199       ;
6200   }
6201 
6202 // DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
6203 #pragma omp target
6204 #pragma omp teams
6205 #pragma omp distribute parallel for simd
6206   for (int i = 0; i < 10; ++i) {
6207 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6208     for (int i = 0; i < 10; ++i)
6209       ;
6210   }
6211 #pragma omp target
6212 #pragma omp teams
6213 #pragma omp distribute parallel for simd
6214   for (int i = 0; i < 10; ++i) {
6215 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6216     for (int i = 0; i < 10; ++i)
6217       ;
6218   }
6219 #pragma omp target
6220 #pragma omp teams
6221 #pragma omp distribute parallel for simd
6222   for (int i = 0; i < 10; ++i) {
6223 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6224     for (int i = 0; i < 10; ++i)
6225       ;
6226   }
6227 #pragma omp target
6228 #pragma omp teams
6229 #pragma omp distribute parallel for simd
6230   for (int i = 0; i < 10; ++i) {
6231 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
6232     for (int i = 0; i < 10; ++i)
6233       ;
6234   }
6235 #pragma omp target
6236 #pragma omp teams
6237 #pragma omp distribute parallel for simd
6238   for (int i = 0; i < 10; ++i) {
6239 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6240     for (int i = 0; i < 10; ++i)
6241       ;
6242   }
6243 #pragma omp target
6244 #pragma omp teams
6245 #pragma omp distribute parallel for simd
6246   for (int i = 0; i < 10; ++i) {
6247 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6248     for (int i = 0; i < 10; ++i)
6249       ;
6250   }
6251 #pragma omp target
6252 #pragma omp teams
6253 #pragma omp distribute parallel for simd
6254   for (int i = 0; i < 10; ++i) {
6255 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6256     {
6257       bar();
6258     }
6259   }
6260 #pragma omp target
6261 #pragma omp teams
6262 #pragma omp distribute parallel for simd
6263   for (int i = 0; i < 10; ++i) {
6264 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6265     {
6266       bar();
6267     }
6268   }
6269 #pragma omp target
6270 #pragma omp teams
6271 #pragma omp distribute parallel for simd
6272   for (int i = 0; i < 10; ++i) {
6273 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6274     {
6275       bar();
6276     }
6277   }
6278 #pragma omp target
6279 #pragma omp teams
6280 #pragma omp distribute parallel for simd
6281   for (int i = 0; i < 10; ++i) {
6282 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6283     {
6284       bar();
6285     }
6286   }
6287 #pragma omp target
6288 #pragma omp teams
6289 #pragma omp distribute parallel for simd
6290   for (int i = 0; i < 10; ++i) {
6291 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6292     {
6293       bar();
6294     }
6295   }
6296 #pragma omp target
6297 #pragma omp teams
6298 #pragma omp distribute parallel for simd
6299   for (int i = 0; i < 10; ++i) {
6300 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6301     {
6302 #pragma omp single
6303       {
6304         bar();
6305       }
6306     }
6307   }
6308 #pragma omp target
6309 #pragma omp teams
6310 #pragma omp distribute parallel for simd
6311   for (int i = 0; i < 10; ++i) {
6312 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6313     for (int i = 0; i < 10; ++i)
6314       ;
6315   }
6316 #pragma omp target
6317 #pragma omp teams
6318 #pragma omp distribute parallel for simd
6319   for (int i = 0; i < 10; ++i) {
6320 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6321     for (int i = 0; i < 10; ++i)
6322       ;
6323   }
6324 #pragma omp target
6325 #pragma omp teams
6326 #pragma omp distribute parallel for simd
6327   for (int i = 0; i < 10; ++i) {
6328 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6329     {
6330       bar();
6331     }
6332   }
6333 #pragma omp target
6334 #pragma omp teams
6335 #pragma omp distribute parallel for simd
6336   for (int i = 0; i < 10; ++i) {
6337 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6338     {
6339       bar();
6340     }
6341   }
6342 #pragma omp target
6343 #pragma omp teams
6344 #pragma omp distribute parallel for simd
6345   for (int i = 0; i < 10; ++i) {
6346 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6347     bar();
6348   }
6349 #pragma omp target
6350 #pragma omp teams
6351 #pragma omp distribute parallel for simd
6352   for (int i = 0; i < 10; ++i) {
6353 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6354     bar();
6355   }
6356 #pragma omp target
6357 #pragma omp teams
6358 #pragma omp distribute parallel for simd
6359   for (int i = 0; i < 10; ++i) {
6360 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6361     bar();
6362   }
6363 #pragma omp target
6364 #pragma omp teams
6365 #pragma omp distribute parallel for simd
6366   for (int i = 0; i < 10; ++i) {
6367 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6368     bar();
6369   }
6370 #pragma omp target
6371 #pragma omp teams
6372 #pragma omp distribute parallel for simd
6373   for (int i = 0; i < 10; ++i) {
6374 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6375     bar();
6376   }
6377 #pragma omp target
6378 #pragma omp teams
6379 #pragma omp distribute parallel for simd
6380   for (int i = 0; i < 10; ++i) {
6381 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
6382     ++a;
6383   }
6384 #pragma omp target
6385 #pragma omp teams
6386 #pragma omp distribute parallel for simd
6387   for (int i = 0; i < 10; ++i) {
6388 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6389     ++a;
6390   }
6391 #pragma omp target
6392 #pragma omp teams
6393 #pragma omp distribute parallel for simd
6394   for (int i = 0; i < 10; ++i) {
6395 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6396     ++a;
6397   }
6398 #pragma omp target
6399 #pragma omp teams
6400 #pragma omp distribute parallel for simd
6401   for (int i = 0; i < 10; ++i) {
6402 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6403     for (int i = 0; i < 10; ++i)
6404       ;
6405   }
6406 #pragma omp target
6407 #pragma omp teams
6408 #pragma omp distribute parallel for simd
6409   for (int i = 0; i < 10; ++i) {
6410 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6411     ++a;
6412   }
6413 #pragma omp target
6414 #pragma omp teams
6415 #pragma omp distribute parallel for simd
6416   for (int i = 0; i < 10; ++i) {
6417 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6418     ++a;
6419   }
6420 #pragma omp target
6421 #pragma omp teams
6422 #pragma omp distribute parallel for simd
6423   for (int i = 0; i < 10; ++i) {
6424 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6425     ++a;
6426   }
6427 #pragma omp target
6428 #pragma omp teams
6429 #pragma omp distribute parallel for simd
6430   for (int i = 0; i < 10; ++i) {
6431 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6432     ++a;
6433   }
6434 #pragma omp target
6435 #pragma omp teams
6436 #pragma omp distribute parallel for simd
6437   for (int i = 0; i < 10; ++i) {
6438 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6439     for (int i = 0; i < 10; ++i)
6440       ++a;
6441   }
6442 #pragma omp target
6443 #pragma omp teams
6444 #pragma omp distribute parallel for simd
6445   for (int i = 0; i < 10; ++i) {
6446 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6447     for (int i = 0; i < 10; ++i)
6448       ++a;
6449   }
6450 #pragma omp target
6451 #pragma omp teams
6452 #pragma omp distribute parallel for simd
6453   for (int i = 0; i < 10; ++i) {
6454 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6455     for (int i = 0; i < 10; ++i)
6456       ++a;
6457   }
6458 #pragma omp target
6459 #pragma omp teams
6460 #pragma omp distribute parallel for simd
6461   for (int i = 0; i < 10; ++i) {
6462 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6463     for (int i = 0; i < 10; ++i)
6464       ++a;
6465   }
6466 #pragma omp target
6467 #pragma omp teams
6468 #pragma omp distribute parallel for simd
6469   for (int i = 0; i < 10; ++i) {
6470 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6471     for (int i = 0; i < 10; ++i)
6472       ++a;
6473   }
6474 #pragma omp target
6475 #pragma omp teams
6476 #pragma omp distribute parallel for simd
6477   for (int i = 0; i < 10; ++i) {
6478 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6479     for (int i = 0; i < 10; ++i)
6480       ++a;
6481   }
6482 #pragma omp target
6483 #pragma omp teams
6484 #pragma omp distribute parallel for simd
6485   for (int i = 0; i < 10; ++i) {
6486 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6487     ++a;
6488   }
6489 #pragma omp target
6490 #pragma omp teams
6491 #pragma omp distribute parallel for simd
6492   for (int i = 0; i < 10; ++i) {
6493 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6494     for (int i = 0; i < 10; ++i)
6495       ++a;
6496   }
6497 #pragma omp target
6498 #pragma omp teams
6499 #pragma omp distribute parallel for simd
6500   for (int i = 0; i < 10; ++i) {
6501 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6502     for (int i = 0; i < 10; ++i)
6503       ++a;
6504   }
6505 #pragma omp target
6506 #pragma omp teams
6507 #pragma omp distribute parallel for simd
6508   for (int i = 0; i < 10; ++i) {
6509 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6510     for (int i = 0; i < 10; ++i)
6511       ++a;
6512   }
6513 #pragma omp target
6514 #pragma omp teams
6515 #pragma omp distribute parallel for simd
6516   for (int i = 0; i < 10; ++i) {
6517 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6518     for (int i = 0; i < 10; ++i)
6519       ++a;
6520   }
6521 
6522 // TARGET SIMD DIRECTIVE
6523 #pragma omp target simd
6524   for (int i = 0; i < 10; ++i) {
6525 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6526     for (int i = 0; i < 10; ++i)
6527       ;
6528   }
6529 #pragma omp target simd
6530   for (int i = 0; i < 10; ++i) {
6531 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6532     for (int i = 0; i < 10; ++i)
6533       ;
6534   }
6535 #pragma omp target simd
6536   for (int i = 0; i < 10; ++i) {
6537 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6538     for (int i = 0; i < 10; ++i)
6539       ;
6540   }
6541 #pragma omp target simd
6542   for (int i = 0; i < 10; ++i) {
6543 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
6544     for (int i = 0; i < 10; ++i)
6545       ;
6546   }
6547 #pragma omp target simd
6548   for (int i = 0; i < 10; ++i) {
6549 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6550     for (int i = 0; i < 10; ++i)
6551       ;
6552   }
6553 #pragma omp target simd
6554   for (int i = 0; i < 10; ++i) {
6555 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6556     for (int i = 0; i < 10; ++i)
6557       ;
6558   }
6559 #pragma omp target simd
6560   for (int i = 0; i < 10; ++i) {
6561 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6562     {
6563       bar();
6564     }
6565   }
6566 #pragma omp target simd
6567   for (int i = 0; i < 10; ++i) {
6568 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6569     {
6570       bar();
6571     }
6572   }
6573 #pragma omp target simd
6574   for (int i = 0; i < 10; ++i) {
6575 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6576     {
6577       bar();
6578     }
6579   }
6580 #pragma omp target simd
6581   for (int i = 0; i < 10; ++i) {
6582 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6583     {
6584       bar();
6585     }
6586   }
6587 #pragma omp target simd
6588   for (int i = 0; i < 10; ++i) {
6589 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6590     {
6591       bar();
6592     }
6593   }
6594 #pragma omp target simd
6595   for (int i = 0; i < 10; ++i) {
6596 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6597     {
6598 #pragma omp single
6599       {
6600         bar();
6601       }
6602     }
6603   }
6604 #pragma omp target simd
6605   for (int i = 0; i < 10; ++i) {
6606 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6607     for (int i = 0; i < 10; ++i)
6608       ;
6609   }
6610 #pragma omp target simd
6611   for (int i = 0; i < 10; ++i) {
6612 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6613     for (int i = 0; i < 10; ++i)
6614       ;
6615   }
6616 #pragma omp target simd
6617   for (int i = 0; i < 10; ++i) {
6618 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6619     {
6620       bar();
6621     }
6622   }
6623 #pragma omp target simd
6624   for (int i = 0; i < 10; ++i) {
6625 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6626     {
6627       bar();
6628     }
6629   }
6630 #pragma omp target simd
6631   for (int i = 0; i < 10; ++i) {
6632 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6633     bar();
6634   }
6635 #pragma omp target simd
6636   for (int i = 0; i < 10; ++i) {
6637 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6638     bar();
6639   }
6640 #pragma omp target simd
6641   for (int i = 0; i < 10; ++i) {
6642 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6643     bar();
6644   }
6645 #pragma omp target simd
6646   for (int i = 0; i < 10; ++i) {
6647 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6648     bar();
6649   }
6650 #pragma omp target simd
6651   for (int i = 0; i < 10; ++i) {
6652 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6653     bar();
6654   }
6655 #pragma omp target simd
6656   for (int i = 0; i < 10; ++i) {
6657 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
6658     ++a;
6659   }
6660 #pragma omp target simd
6661   for (int i = 0; i < 10; ++i) {
6662 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6663     ++a;
6664   }
6665 #pragma omp target simd
6666   for (int i = 0; i < 10; ++i) {
6667 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6668     ++a;
6669   }
6670 #pragma omp target simd
6671   for (int i = 0; i < 10; ++i) {
6672 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6673     for (int i = 0; i < 10; ++i)
6674       ;
6675   }
6676 #pragma omp target simd
6677   for (int i = 0; i < 10; ++i) {
6678 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6679     ++a;
6680   }
6681 #pragma omp target simd
6682   for (int i = 0; i < 10; ++i) {
6683 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6684     ++a;
6685   }
6686 #pragma omp target simd
6687   for (int i = 0; i < 10; ++i) {
6688 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6689     ++a;
6690   }
6691 #pragma omp target simd
6692   for (int i = 0; i < 10; ++i) {
6693 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6694     ++a;
6695   }
6696 #pragma omp target simd
6697   for (int i = 0; i < 10; ++i) {
6698 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6699     for (int i = 0; i < 10; ++i)
6700       ++a;
6701   }
6702 #pragma omp target simd
6703   for (int i = 0; i < 10; ++i) {
6704 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6705     for (int i = 0; i < 10; ++i)
6706       ++a;
6707   }
6708 #pragma omp target simd
6709   for (int i = 0; i < 10; ++i) {
6710 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6711     for (int i = 0; i < 10; ++i)
6712       ++a;
6713   }
6714 #pragma omp target simd
6715   for (int i = 0; i < 10; ++i) {
6716 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6717     for (int i = 0; i < 10; ++i)
6718       ++a;
6719   }
6720 #pragma omp target simd
6721   for (int i = 0; i < 10; ++i) {
6722 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6723     for (int i = 0; i < 10; ++i)
6724       ++a;
6725   }
6726 #pragma omp target simd
6727   for (int i = 0; i < 10; ++i) {
6728 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6729     for (int i = 0; i < 10; ++i)
6730       ++a;
6731   }
6732 #pragma omp target simd
6733   for (int i = 0; i < 10; ++i) {
6734 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6735     for (int i = 0; i < 10; ++i)
6736       ++a;
6737   }
6738 #pragma omp target simd
6739   for (int i = 0; i < 10; ++i) {
6740 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6741     for (int i = 0; i < 10; ++i)
6742       ++a;
6743   }
6744 
6745 // TEAMS DISTRIBUTE DIRECTIVE
6746 #pragma omp teams distribute // omp45-error {{orphaned 'omp teams distribute' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
6747   for (int i = 0; i < 10; ++i)
6748     ;
6749 #pragma omp target
6750 #pragma omp teams distribute
6751   for (int i = 0; i < 10; ++i) {
6752 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
6753     for (int i = 0; i < 10; ++i)
6754       ;
6755   }
6756 #pragma omp target
6757 #pragma omp teams distribute
6758   for (int i = 0; i < 10; ++i) {
6759 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
6760     for (int i = 0; i < 10; ++i)
6761       ;
6762   }
6763 #pragma omp target
6764 #pragma omp teams distribute
6765   for (int i = 0; i < 10; ++i) {
6766 #pragma omp for // OK
6767     for (int i = 0; i < 10; ++i)
6768       ;
6769   }
6770 #pragma omp target
6771 #pragma omp teams distribute
6772   for (int i = 0; i < 10; ++i) {
6773 #pragma omp simd // OK
6774     for (int i = 0; i < 10; ++i)
6775       ;
6776   }
6777 #pragma omp target
6778 #pragma omp teams distribute
6779   for (int i = 0; i < 10; ++i) {
6780 #pragma omp for simd // OK
6781     for (int i = 0; i < 10; ++i)
6782       ;
6783   }
6784 #pragma omp target
6785 #pragma omp teams distribute
6786   for (int i = 0; i < 10; ++i) {
6787 #pragma omp parallel // OK
6788     for (int i = 0; i < 10; ++i)
6789       ;
6790   }
6791 #pragma omp target
6792 #pragma omp teams distribute
6793   for (int i = 0; i < 10; ++i) {
6794 #pragma omp sections // OK
6795     {
6796       bar();
6797     }
6798   }
6799 #pragma omp target
6800 #pragma omp teams distribute
6801   for (int i = 0; i < 10; ++i) {
6802 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute region}}
6803     {
6804       bar();
6805     }
6806   }
6807 #pragma omp target
6808 #pragma omp teams distribute
6809   for (int i = 0; i < 10; ++i) {
6810 #pragma omp single // OK
6811     {
6812       bar();
6813     }
6814   }
6815 #pragma omp target
6816 #pragma omp teams distribute
6817   for (int i = 0; i < 10; ++i) {
6818 #pragma omp master // OK
6819     {
6820       bar();
6821     }
6822   }
6823 #pragma omp target
6824 #pragma omp teams distribute
6825   for (int i = 0; i < 10; ++i) {
6826 #pragma omp critical // OK
6827     {
6828       bar();
6829     }
6830   }
6831 #pragma omp target
6832 #pragma omp teams distribute
6833   for (int i = 0; i < 10; ++i) {
6834 #pragma omp parallel // OK
6835     {
6836 #pragma omp single
6837       {
6838         bar();
6839       }
6840     }
6841   }
6842 #pragma omp target
6843 #pragma omp teams distribute
6844   for (int i = 0; i < 10; ++i) {
6845 #pragma omp parallel for // OK
6846     for (int i = 0; i < 10; ++i)
6847       ;
6848   }
6849 #pragma omp target
6850 #pragma omp teams distribute
6851   for (int i = 0; i < 10; ++i) {
6852 #pragma omp parallel for simd // OK
6853     for (int i = 0; i < 10; ++i)
6854       ;
6855   }
6856 #pragma omp target
6857 #pragma omp teams distribute
6858   for (int i = 0; i < 10; ++i) {
6859 #pragma omp parallel sections // OK
6860     {
6861       bar();
6862     }
6863   }
6864 #pragma omp target
6865 #pragma omp teams distribute
6866   for (int i = 0; i < 10; ++i) {
6867 #pragma omp task // OK
6868     {
6869       bar();
6870     }
6871   }
6872 #pragma omp target
6873 #pragma omp teams distribute
6874   for (int i = 0; i < 10; ++i) {
6875 #pragma omp taskyield // OK
6876     bar();
6877   }
6878 #pragma omp target
6879 #pragma omp teams distribute
6880   for (int i = 0; i < 10; ++i) {
6881 #pragma omp barrier // OK
6882     bar();
6883   }
6884 #pragma omp target
6885 #pragma omp teams distribute
6886   for (int i = 0; i < 10; ++i) {
6887 #pragma omp taskwait // OK
6888     bar();
6889   }
6890 #pragma omp target
6891 #pragma omp teams distribute
6892   for (int i = 0; i < 10; ++i) {
6893 #pragma omp flush // OK
6894     bar();
6895   }
6896 #pragma omp target
6897 #pragma omp teams distribute
6898   for (int i = 0; i < 10; ++i) {
6899 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
6900     bar();
6901   }
6902 #pragma omp target
6903 #pragma omp teams distribute
6904   for (int i = 0; i < 10; ++i) {
6905 #pragma omp atomic // OK
6906     ++a;
6907   }
6908 #pragma omp target
6909 #pragma omp teams distribute
6910   for (int i = 0; i < 10; ++i) {
6911 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
6912     ++a;
6913   }
6914 #pragma omp target
6915 #pragma omp teams distribute
6916   for (int i = 0; i < 10; ++i) {
6917 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
6918     ++a;
6919   }
6920 #pragma omp target
6921 #pragma omp teams distribute
6922   for (int i = 0; i < 10; ++i) {
6923 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
6924     for (int i = 0; i < 10; ++i)
6925       ;
6926   }
6927 #pragma omp target
6928 #pragma omp teams distribute
6929   for (int i = 0; i < 10; ++i) {
6930 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
6931     ++a;
6932   }
6933 #pragma omp target
6934 #pragma omp teams distribute
6935   for (int i = 0; i < 10; ++i) {
6936 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
6937     ++a;
6938   }
6939 #pragma omp target
6940 #pragma omp teams distribute
6941   for (int i = 0; i < 10; ++i) {
6942 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
6943     ++a;
6944   }
6945 #pragma omp target
6946 #pragma omp teams distribute
6947   for (int i = 0; i < 10; ++i) {
6948 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
6949     ++a;
6950   }
6951 #pragma omp target
6952 #pragma omp teams distribute
6953   for (int i = 0; i < 10; ++i) {
6954 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
6955     for (int i = 0; i < 10; ++i)
6956       ++a;
6957   }
6958 #pragma omp target
6959 #pragma omp teams distribute
6960   for (int i = 0; i < 10; ++i) {
6961 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
6962     for (int i = 0; i < 10; ++i)
6963       ++a;
6964   }
6965 #pragma omp target
6966 #pragma omp teams distribute
6967   for (int i = 0; i < 10; ++i) {
6968 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
6969     for (int i = 0; i < 10; ++i)
6970       ++a;
6971   }
6972 #pragma omp target
6973 #pragma omp teams distribute
6974   for (int i = 0; i < 10; ++i) {
6975 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
6976     for (int i = 0; i < 10; ++i)
6977       ++a;
6978   }
6979 #pragma omp target
6980 #pragma omp teams distribute
6981   for (int i = 0; i < 10; ++i) {
6982 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
6983     for (int i = 0; i < 10; ++i)
6984       ++a;
6985   }
6986 #pragma omp target
6987 #pragma omp teams distribute
6988   for (int i = 0; i < 10; ++i) {
6989 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
6990     for (int i = 0; i < 10; ++i)
6991       ++a;
6992   }
6993 #pragma omp target
6994 #pragma omp teams distribute
6995   for (int i = 0; i < 10; ++i) {
6996 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
6997     for (int i = 0; i < 10; ++i)
6998       ++a;
6999   }
7000 #pragma omp target
7001 #pragma omp teams distribute
7002   for (int i = 0; i < 10; ++i) {
7003 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
7004     for (int i = 0; i < 10; ++i)
7005       ++a;
7006   }
7007 
7008 // TEAMS DISTRIBUTE DIRECTIVE
7009 #pragma omp teams distribute // omp45-error {{orphaned 'omp teams distribute' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
7010   for (int i = 0; i < 10; ++i)
7011     ;
7012 #pragma omp target
7013 #pragma omp teams distribute
7014   for (int i = 0; i < 10; ++i) {
7015 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
7016     for (int i = 0; i < 10; ++i)
7017       ;
7018   }
7019 #pragma omp target
7020 #pragma omp teams distribute
7021   for (int i = 0; i < 10; ++i) {
7022 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
7023     for (int i = 0; i < 10; ++i)
7024       ;
7025   }
7026 #pragma omp target
7027 #pragma omp teams distribute
7028   for (int i = 0; i < 10; ++i) {
7029 #pragma omp for // OK
7030     for (int i = 0; i < 10; ++i)
7031       ;
7032   }
7033 #pragma omp target
7034 #pragma omp teams distribute
7035   for (int i = 0; i < 10; ++i) {
7036 #pragma omp simd // OK
7037     for (int i = 0; i < 10; ++i)
7038       ;
7039   }
7040 #pragma omp target
7041 #pragma omp teams distribute
7042   for (int i = 0; i < 10; ++i) {
7043 #pragma omp for simd // OK
7044     for (int i = 0; i < 10; ++i)
7045       ;
7046   }
7047 #pragma omp target
7048 #pragma omp teams distribute
7049   for (int i = 0; i < 10; ++i) {
7050 #pragma omp parallel // OK
7051     for (int i = 0; i < 10; ++i)
7052       ;
7053   }
7054 #pragma omp target
7055 #pragma omp teams distribute
7056   for (int i = 0; i < 10; ++i) {
7057 #pragma omp sections // OK
7058     {
7059       bar();
7060     }
7061   }
7062 #pragma omp target
7063 #pragma omp teams distribute
7064   for (int i = 0; i < 10; ++i) {
7065 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute region}}
7066     {
7067       bar();
7068     }
7069   }
7070 #pragma omp target
7071 #pragma omp teams distribute
7072   for (int i = 0; i < 10; ++i) {
7073 #pragma omp single // OK
7074     {
7075       bar();
7076     }
7077   }
7078 #pragma omp target
7079 #pragma omp teams distribute
7080   for (int i = 0; i < 10; ++i) {
7081 #pragma omp master // OK
7082     {
7083       bar();
7084     }
7085   }
7086 #pragma omp target
7087 #pragma omp teams distribute
7088   for (int i = 0; i < 10; ++i) {
7089 #pragma omp critical // OK
7090     {
7091       bar();
7092     }
7093   }
7094 #pragma omp target
7095 #pragma omp teams distribute
7096   for (int i = 0; i < 10; ++i) {
7097 #pragma omp parallel // OK
7098     {
7099 #pragma omp single
7100       {
7101         bar();
7102       }
7103     }
7104   }
7105 #pragma omp target
7106 #pragma omp teams distribute
7107   for (int i = 0; i < 10; ++i) {
7108 #pragma omp parallel for // OK
7109     for (int i = 0; i < 10; ++i)
7110       ;
7111   }
7112 #pragma omp target
7113 #pragma omp teams distribute
7114   for (int i = 0; i < 10; ++i) {
7115 #pragma omp parallel for simd // OK
7116     for (int i = 0; i < 10; ++i)
7117       ;
7118   }
7119 #pragma omp target
7120 #pragma omp teams distribute
7121   for (int i = 0; i < 10; ++i) {
7122 #pragma omp parallel sections // OK
7123     {
7124       bar();
7125     }
7126   }
7127 #pragma omp target
7128 #pragma omp teams distribute
7129   for (int i = 0; i < 10; ++i) {
7130 #pragma omp task // OK
7131     {
7132       bar();
7133     }
7134   }
7135 #pragma omp target
7136 #pragma omp teams distribute
7137   for (int i = 0; i < 10; ++i) {
7138 #pragma omp taskyield // OK
7139     bar();
7140   }
7141 #pragma omp target
7142 #pragma omp teams distribute
7143   for (int i = 0; i < 10; ++i) {
7144 #pragma omp barrier // OK
7145     bar();
7146   }
7147 #pragma omp target
7148 #pragma omp teams distribute
7149   for (int i = 0; i < 10; ++i) {
7150 #pragma omp taskwait // OK
7151     bar();
7152   }
7153 #pragma omp target
7154 #pragma omp teams distribute
7155   for (int i = 0; i < 10; ++i) {
7156 #pragma omp flush // OK
7157     bar();
7158   }
7159 #pragma omp target
7160 #pragma omp teams distribute
7161   for (int i = 0; i < 10; ++i) {
7162 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
7163     bar();
7164   }
7165 #pragma omp target
7166 #pragma omp teams distribute
7167   for (int i = 0; i < 10; ++i) {
7168 #pragma omp atomic // OK
7169     ++a;
7170   }
7171 #pragma omp target
7172 #pragma omp teams distribute
7173   for (int i = 0; i < 10; ++i) {
7174 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
7175     ++a;
7176   }
7177 #pragma omp target
7178 #pragma omp teams distribute
7179   for (int i = 0; i < 10; ++i) {
7180 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
7181     ++a;
7182   }
7183 #pragma omp target
7184 #pragma omp teams distribute
7185   for (int i = 0; i < 10; ++i) {
7186 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
7187     for (int i = 0; i < 10; ++i)
7188       ;
7189   }
7190 #pragma omp target
7191 #pragma omp teams distribute
7192   for (int i = 0; i < 10; ++i) {
7193 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
7194     ++a;
7195   }
7196 #pragma omp target
7197 #pragma omp teams distribute
7198   for (int i = 0; i < 10; ++i) {
7199 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
7200     ++a;
7201   }
7202 #pragma omp target
7203 #pragma omp teams distribute
7204   for (int i = 0; i < 10; ++i) {
7205 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
7206     ++a;
7207   }
7208 #pragma omp target
7209 #pragma omp teams distribute
7210   for (int i = 0; i < 10; ++i) {
7211 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
7212     ++a;
7213   }
7214 #pragma omp target
7215 #pragma omp teams distribute
7216   for (int i = 0; i < 10; ++i) {
7217 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
7218     for (int i = 0; i < 10; ++i)
7219       ++a;
7220   }
7221 #pragma omp target
7222 #pragma omp teams distribute
7223   for (int i = 0; i < 10; ++i) {
7224 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
7225     for (int i = 0; i < 10; ++i)
7226       ++a;
7227   }
7228 #pragma omp target
7229 #pragma omp teams distribute
7230   for (int i = 0; i < 10; ++i) {
7231 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
7232     for (int i = 0; i < 10; ++i)
7233       ++a;
7234   }
7235 #pragma omp target
7236 #pragma omp teams distribute
7237   for (int i = 0; i < 10; ++i) {
7238 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
7239     for (int i = 0; i < 10; ++i)
7240       ++a;
7241   }
7242 #pragma omp target
7243 #pragma omp teams distribute
7244   for (int i = 0; i < 10; ++i) {
7245 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
7246     for (int i = 0; i < 10; ++i)
7247       ++a;
7248   }
7249 #pragma omp target
7250 #pragma omp teams distribute
7251   for (int i = 0; i < 10; ++i) {
7252 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
7253     for (int i = 0; i < 10; ++i)
7254       ++a;
7255   }
7256 #pragma omp target
7257 #pragma omp teams distribute
7258   for (int i = 0; i < 10; ++i) {
7259 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
7260     ++a;
7261   }
7262 #pragma omp target
7263 #pragma omp teams distribute
7264   for (int i = 0; i < 10; ++i) {
7265 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
7266     for (int i = 0; i < 10; ++i)
7267       ++a;
7268   }
7269 #pragma omp target
7270 #pragma omp teams distribute
7271   for (int i = 0; i < 10; ++i) {
7272 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
7273     for (int i = 0; i < 10; ++i)
7274       ++a;
7275   }
7276 #pragma omp target
7277 #pragma omp teams distribute
7278   for (int i = 0; i < 10; ++i) {
7279 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
7280     for (int i = 0; i < 10; ++i)
7281       ++a;
7282   }
7283 #pragma omp target
7284 #pragma omp teams distribute
7285   for (int i = 0; i < 10; ++i) {
7286 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
7287     for (int i = 0; i < 10; ++i)
7288       ++a;
7289   }
7290 
7291 // TEAMS DISTRIBUTE SIMD DIRECTIVE
7292 #pragma omp teams distribute simd // omp45-error {{orphaned 'omp teams distribute simd' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
7293   for (int i = 0; i < 10; ++i)
7294     ;
7295 #pragma omp target
7296 #pragma omp teams distribute simd
7297   for (int i = 0; i < 10; ++i) {
7298 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7299     for (int i = 0; i < 10; ++i)
7300       ;
7301   }
7302 #pragma omp target
7303 #pragma omp teams distribute simd
7304   for (int i = 0; i < 10; ++i) {
7305 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7306     for (int i = 0; i < 10; ++i)
7307       ;
7308   }
7309 #pragma omp target
7310 #pragma omp teams distribute simd
7311   for (int i = 0; i < 10; ++i) {
7312 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7313     for (int i = 0; i < 10; ++i)
7314       ;
7315   }
7316 #pragma omp target
7317 #pragma omp teams distribute simd
7318   for (int i = 0; i < 10; ++i) {
7319 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
7320     for (int i = 0; i < 10; ++i)
7321       ;
7322   }
7323 #pragma omp target
7324 #pragma omp teams distribute simd
7325   for (int i = 0; i < 10; ++i) {
7326 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7327     for (int i = 0; i < 10; ++i)
7328       ;
7329   }
7330 #pragma omp target
7331 #pragma omp teams distribute simd
7332   for (int i = 0; i < 10; ++i) {
7333 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7334     for (int i = 0; i < 10; ++i)
7335       ;
7336   }
7337 #pragma omp target
7338 #pragma omp teams distribute simd
7339   for (int i = 0; i < 10; ++i) {
7340 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7341     {
7342       bar();
7343     }
7344   }
7345 #pragma omp target
7346 #pragma omp teams distribute simd
7347   for (int i = 0; i < 10; ++i) {
7348 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7349     {
7350       bar();
7351     }
7352   }
7353 #pragma omp target
7354 #pragma omp teams distribute simd
7355   for (int i = 0; i < 10; ++i) {
7356 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7357     {
7358       bar();
7359     }
7360   }
7361 #pragma omp target
7362 #pragma omp teams distribute simd
7363   for (int i = 0; i < 10; ++i) {
7364 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7365     {
7366       bar();
7367     }
7368   }
7369 #pragma omp target
7370 #pragma omp teams distribute simd
7371   for (int i = 0; i < 10; ++i) {
7372 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7373     {
7374       bar();
7375     }
7376   }
7377 #pragma omp target
7378 #pragma omp teams distribute simd
7379   for (int i = 0; i < 10; ++i) {
7380 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7381     {
7382 #pragma omp single
7383       {
7384         bar();
7385       }
7386     }
7387   }
7388 #pragma omp target
7389 #pragma omp teams distribute simd
7390   for (int i = 0; i < 10; ++i) {
7391 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7392     for (int i = 0; i < 10; ++i)
7393       ;
7394   }
7395 #pragma omp target
7396 #pragma omp teams distribute simd
7397   for (int i = 0; i < 10; ++i) {
7398 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7399     for (int i = 0; i < 10; ++i)
7400       ;
7401   }
7402 #pragma omp target
7403 #pragma omp teams distribute simd
7404   for (int i = 0; i < 10; ++i) {
7405 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7406     {
7407       bar();
7408     }
7409   }
7410 #pragma omp target
7411 #pragma omp teams distribute simd
7412   for (int i = 0; i < 10; ++i) {
7413 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7414     {
7415       bar();
7416     }
7417   }
7418 #pragma omp target
7419 #pragma omp teams distribute simd
7420   for (int i = 0; i < 10; ++i) {
7421 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7422     bar();
7423   }
7424 #pragma omp target
7425 #pragma omp teams distribute simd
7426   for (int i = 0; i < 10; ++i) {
7427 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7428     bar();
7429   }
7430 #pragma omp target
7431 #pragma omp teams distribute simd
7432   for (int i = 0; i < 10; ++i) {
7433 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7434     bar();
7435   }
7436 #pragma omp target
7437 #pragma omp teams distribute simd
7438   for (int i = 0; i < 10; ++i) {
7439 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7440     bar();
7441   }
7442 #pragma omp target
7443 #pragma omp teams distribute simd
7444   for (int i = 0; i < 10; ++i) {
7445 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7446     bar();
7447   }
7448 #pragma omp target
7449 #pragma omp teams distribute simd
7450   for (int i = 0; i < 10; ++i) {
7451 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
7452     ++a;
7453   }
7454 #pragma omp target
7455 #pragma omp teams distribute simd
7456   for (int i = 0; i < 10; ++i) {
7457 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7458     ++a;
7459   }
7460 #pragma omp target
7461 #pragma omp teams distribute simd
7462   for (int i = 0; i < 10; ++i) {
7463 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7464     ++a;
7465   }
7466 #pragma omp target
7467 #pragma omp teams distribute simd
7468   for (int i = 0; i < 10; ++i) {
7469 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7470     for (int i = 0; i < 10; ++i)
7471       ;
7472   }
7473 #pragma omp target
7474 #pragma omp teams distribute simd
7475   for (int i = 0; i < 10; ++i) {
7476 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7477     ++a;
7478   }
7479 #pragma omp target
7480 #pragma omp teams distribute simd
7481   for (int i = 0; i < 10; ++i) {
7482 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7483     ++a;
7484   }
7485 #pragma omp target
7486 #pragma omp teams distribute simd
7487   for (int i = 0; i < 10; ++i) {
7488 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7489     ++a;
7490   }
7491 #pragma omp target
7492 #pragma omp teams distribute simd
7493   for (int i = 0; i < 10; ++i) {
7494 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7495     ++a;
7496   }
7497 #pragma omp target
7498 #pragma omp teams distribute simd
7499   for (int i = 0; i < 10; ++i) {
7500 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7501     for (int i = 0; i < 10; ++i)
7502       ++a;
7503   }
7504 #pragma omp target
7505 #pragma omp teams distribute simd
7506   for (int i = 0; i < 10; ++i) {
7507 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7508     for (int i = 0; i < 10; ++i)
7509       ++a;
7510   }
7511 #pragma omp target
7512 #pragma omp teams distribute simd
7513   for (int i = 0; i < 10; ++i) {
7514 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7515     for (int i = 0; i < 10; ++i)
7516       ++a;
7517   }
7518 #pragma omp target
7519 #pragma omp teams distribute simd
7520   for (int i = 0; i < 10; ++i) {
7521 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7522     for (int i = 0; i < 10; ++i)
7523       ++a;
7524   }
7525 #pragma omp target
7526 #pragma omp teams distribute simd
7527   for (int i = 0; i < 10; ++i) {
7528 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7529     for (int i = 0; i < 10; ++i)
7530       ++a;
7531   }
7532 #pragma omp target
7533 #pragma omp teams distribute simd
7534   for (int i = 0; i < 10; ++i) {
7535 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7536     for (int i = 0; i < 10; ++i)
7537       ++a;
7538   }
7539 #pragma omp target
7540 #pragma omp teams distribute simd
7541   for (int i = 0; i < 10; ++i) {
7542 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7543     ++a;
7544   }
7545 #pragma omp target
7546 #pragma omp teams distribute simd
7547   for (int i = 0; i < 10; ++i) {
7548 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7549     for (int i = 0; i < 10; ++i)
7550       ++a;
7551   }
7552 #pragma omp target
7553 #pragma omp teams distribute simd
7554   for (int i = 0; i < 10; ++i) {
7555 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7556     for (int i = 0; i < 10; ++i)
7557       ++a;
7558   }
7559 #pragma omp target
7560 #pragma omp teams distribute simd
7561   for (int i = 0; i < 10; ++i) {
7562 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7563     for (int i = 0; i < 10; ++i)
7564       ++a;
7565   }
7566 #pragma omp target
7567 #pragma omp teams distribute simd
7568   for (int i = 0; i < 10; ++i) {
7569 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7570     for (int i = 0; i < 10; ++i)
7571       ++a;
7572   }
7573 
7574 // TEAMS DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
7575 #pragma omp teams distribute parallel for simd // omp45-error {{orphaned 'omp teams distribute parallel for simd' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
7576   for (int i = 0; i < 10; ++i)
7577     ;
7578 #pragma omp target
7579 #pragma omp teams distribute parallel for simd
7580   for (int i = 0; i < 10; ++i) {
7581 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7582     for (int i = 0; i < 10; ++i)
7583       ;
7584   }
7585 #pragma omp target
7586 #pragma omp teams distribute parallel for simd
7587   for (int i = 0; i < 10; ++i) {
7588 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7589     for (int i = 0; i < 10; ++i)
7590       ;
7591   }
7592 #pragma omp target
7593 #pragma omp teams distribute parallel for simd
7594   for (int i = 0; i < 10; ++i) {
7595 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7596     for (int i = 0; i < 10; ++i)
7597       ;
7598   }
7599 #pragma omp target
7600 #pragma omp teams distribute parallel for simd
7601   for (int i = 0; i < 10; ++i) {
7602 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
7603     for (int i = 0; i < 10; ++i)
7604       ;
7605   }
7606 #pragma omp target
7607 #pragma omp teams distribute parallel for simd
7608   for (int i = 0; i < 10; ++i) {
7609 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7610     for (int i = 0; i < 10; ++i)
7611       ;
7612   }
7613 #pragma omp target
7614 #pragma omp teams distribute parallel for simd
7615   for (int i = 0; i < 10; ++i) {
7616 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7617     for (int i = 0; i < 10; ++i)
7618       ;
7619   }
7620 #pragma omp target
7621 #pragma omp teams distribute parallel for simd
7622   for (int i = 0; i < 10; ++i) {
7623 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7624     {
7625       bar();
7626     }
7627   }
7628 #pragma omp target
7629 #pragma omp teams distribute parallel for simd
7630   for (int i = 0; i < 10; ++i) {
7631 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7632     {
7633       bar();
7634     }
7635   }
7636 #pragma omp target
7637 #pragma omp teams distribute parallel for simd
7638   for (int i = 0; i < 10; ++i) {
7639 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7640     {
7641       bar();
7642     }
7643   }
7644 #pragma omp target
7645 #pragma omp teams distribute parallel for simd
7646   for (int i = 0; i < 10; ++i) {
7647 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7648     {
7649       bar();
7650     }
7651   }
7652 #pragma omp target
7653 #pragma omp teams distribute parallel for simd
7654   for (int i = 0; i < 10; ++i) {
7655 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7656     {
7657       bar();
7658     }
7659   }
7660 #pragma omp target
7661 #pragma omp teams distribute parallel for simd
7662   for (int i = 0; i < 10; ++i) {
7663 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7664     {
7665 #pragma omp single
7666       {
7667         bar();
7668       }
7669     }
7670   }
7671 #pragma omp target
7672 #pragma omp teams distribute parallel for simd
7673   for (int i = 0; i < 10; ++i) {
7674 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7675     for (int i = 0; i < 10; ++i)
7676       ;
7677   }
7678 #pragma omp target
7679 #pragma omp teams distribute parallel for simd
7680   for (int i = 0; i < 10; ++i) {
7681 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7682     for (int i = 0; i < 10; ++i)
7683       ;
7684   }
7685 #pragma omp target
7686 #pragma omp teams distribute parallel for simd
7687   for (int i = 0; i < 10; ++i) {
7688 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7689     {
7690       bar();
7691     }
7692   }
7693 #pragma omp target
7694 #pragma omp teams distribute parallel for simd
7695   for (int i = 0; i < 10; ++i) {
7696 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7697     {
7698       bar();
7699     }
7700   }
7701 #pragma omp target
7702 #pragma omp teams distribute parallel for simd
7703   for (int i = 0; i < 10; ++i) {
7704 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7705     bar();
7706   }
7707 #pragma omp target
7708 #pragma omp teams distribute parallel for simd
7709   for (int i = 0; i < 10; ++i) {
7710 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7711     bar();
7712   }
7713 #pragma omp target
7714 #pragma omp teams distribute parallel for simd
7715   for (int i = 0; i < 10; ++i) {
7716 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7717     bar();
7718   }
7719 #pragma omp target
7720 #pragma omp teams distribute parallel for simd
7721   for (int i = 0; i < 10; ++i) {
7722 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7723     bar();
7724   }
7725 #pragma omp target
7726 #pragma omp teams distribute parallel for simd
7727   for (int i = 0; i < 10; ++i) {
7728 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7729     bar();
7730   }
7731 #pragma omp target
7732 #pragma omp teams distribute parallel for simd
7733   for (int i = 0; i < 10; ++i) {
7734 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
7735     ++a;
7736   }
7737 #pragma omp target
7738 #pragma omp teams distribute parallel for simd
7739   for (int i = 0; i < 10; ++i) {
7740 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7741     ++a;
7742   }
7743 #pragma omp target
7744 #pragma omp teams distribute parallel for simd
7745   for (int i = 0; i < 10; ++i) {
7746 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7747     ++a;
7748   }
7749 #pragma omp target
7750 #pragma omp teams distribute parallel for simd
7751   for (int i = 0; i < 10; ++i) {
7752 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7753     for (int i = 0; i < 10; ++i)
7754       ;
7755   }
7756 #pragma omp target
7757 #pragma omp teams distribute parallel for simd
7758   for (int i = 0; i < 10; ++i) {
7759 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7760     ++a;
7761   }
7762 #pragma omp target
7763 #pragma omp teams distribute parallel for simd
7764   for (int i = 0; i < 10; ++i) {
7765 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7766     ++a;
7767   }
7768 #pragma omp target
7769 #pragma omp teams distribute parallel for simd
7770   for (int i = 0; i < 10; ++i) {
7771 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7772     ++a;
7773   }
7774 #pragma omp target
7775 #pragma omp teams distribute parallel for simd
7776   for (int i = 0; i < 10; ++i) {
7777 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7778     ++a;
7779   }
7780 #pragma omp target
7781 #pragma omp teams distribute parallel for simd
7782   for (int i = 0; i < 10; ++i) {
7783 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7784     for (int i = 0; i < 10; ++i)
7785       ++a;
7786   }
7787 #pragma omp target
7788 #pragma omp teams distribute parallel for simd
7789   for (int i = 0; i < 10; ++i) {
7790 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7791     for (int i = 0; i < 10; ++i)
7792       ++a;
7793   }
7794 #pragma omp target
7795 #pragma omp teams distribute parallel for simd
7796   for (int i = 0; i < 10; ++i) {
7797 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7798     for (int i = 0; i < 10; ++i)
7799       ++a;
7800   }
7801 #pragma omp target
7802 #pragma omp teams distribute parallel for simd
7803   for (int i = 0; i < 10; ++i) {
7804 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7805     for (int i = 0; i < 10; ++i)
7806       ++a;
7807   }
7808 #pragma omp target
7809 #pragma omp teams distribute parallel for simd
7810   for (int i = 0; i < 10; ++i) {
7811 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7812     for (int i = 0; i < 10; ++i)
7813       ++a;
7814   }
7815 #pragma omp target
7816 #pragma omp teams distribute parallel for simd
7817   for (int i = 0; i < 10; ++i) {
7818 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7819     for (int i = 0; i < 10; ++i)
7820       ++a;
7821   }
7822 #pragma omp target
7823 #pragma omp teams distribute parallel for simd
7824   for (int i = 0; i < 10; ++i) {
7825 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7826     ++a;
7827   }
7828 #pragma omp target
7829 #pragma omp teams distribute parallel for simd
7830   for (int i = 0; i < 10; ++i) {
7831 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7832     for (int i = 0; i < 10; ++i)
7833       ++a;
7834   }
7835 #pragma omp target
7836 #pragma omp teams distribute parallel for simd
7837   for (int i = 0; i < 10; ++i) {
7838 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7839     for (int i = 0; i < 10; ++i)
7840       ++a;
7841   }
7842 #pragma omp target
7843 #pragma omp teams distribute parallel for simd
7844   for (int i = 0; i < 10; ++i) {
7845 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7846     for (int i = 0; i < 10; ++i)
7847       ++a;
7848   }
7849 #pragma omp target
7850 #pragma omp teams distribute parallel for simd
7851   for (int i = 0; i < 10; ++i) {
7852 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7853     for (int i = 0; i < 10; ++i)
7854       ++a;
7855   }
7856 
7857 // TEAMS DISTRIBUTE PARALLEL FOR DIRECTIVE
7858 #pragma omp teams distribute parallel for // omp45-error {{orphaned 'omp teams distribute parallel for' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
7859   for (int i = 0; i < 10; ++i)
7860     ;
7861 #pragma omp target
7862 #pragma omp teams distribute parallel for
7863   for (int i = 0; i < 10; ++i) {
7864 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
7865     for (int i = 0; i < 10; ++i)
7866       ;
7867   }
7868 #pragma omp target
7869 #pragma omp teams distribute parallel for
7870   for (int i = 0; i < 10; ++i) {
7871 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
7872     for (int i = 0; i < 10; ++i)
7873       ;
7874   }
7875 #pragma omp target
7876 #pragma omp teams distribute parallel for
7877   for (int i = 0; i < 10; ++i) {
7878 #pragma omp for // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
7879     for (int i = 0; i < 10; ++i)
7880       ;
7881   }
7882 #pragma omp target
7883 #pragma omp teams distribute parallel for
7884   for (int i = 0; i < 10; ++i) {
7885 #pragma omp simd // OK
7886     for (int i = 0; i < 10; ++i)
7887       ;
7888   }
7889 #pragma omp target
7890 #pragma omp teams distribute parallel for
7891   for (int i = 0; i < 10; ++i) {
7892 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
7893     for (int i = 0; i < 10; ++i)
7894       ;
7895   }
7896 #pragma omp target
7897 #pragma omp teams distribute parallel for
7898   for (int i = 0; i < 10; ++i) {
7899 #pragma omp parallel // OK
7900     for (int i = 0; i < 10; ++i)
7901       ;
7902   }
7903 #pragma omp target
7904 #pragma omp teams distribute parallel for
7905   for (int i = 0; i < 10; ++i) {
7906 #pragma omp sections // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
7907     {
7908       bar();
7909     }
7910   }
7911 #pragma omp target
7912 #pragma omp teams distribute parallel for
7913   for (int i = 0; i < 10; ++i) {
7914 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute parallel for region}}
7915     {
7916       bar();
7917     }
7918   }
7919 #pragma omp target
7920 #pragma omp teams distribute parallel for
7921   for (int i = 0; i < 10; ++i) {
7922 #pragma omp single // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
7923     {
7924       bar();
7925     }
7926   }
7927 #pragma omp target
7928 #pragma omp teams distribute parallel for
7929   for (int i = 0; i < 10; ++i) {
7930 #pragma omp master // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region}}
7931     {
7932       bar();
7933     }
7934   }
7935 #pragma omp target
7936 #pragma omp teams distribute parallel for
7937   for (int i = 0; i < 10; ++i) {
7938 #pragma omp critical // OK
7939     {
7940       bar();
7941     }
7942   }
7943 #pragma omp target
7944 #pragma omp teams distribute parallel for
7945   for (int i = 0; i < 10; ++i) {
7946 #pragma omp parallel // OK
7947     {
7948 #pragma omp single
7949       {
7950         bar();
7951       }
7952     }
7953   }
7954 #pragma omp target
7955 #pragma omp teams distribute parallel for
7956   for (int i = 0; i < 10; ++i) {
7957 #pragma omp parallel for // OK
7958     for (int i = 0; i < 10; ++i)
7959       ;
7960   }
7961 #pragma omp target
7962 #pragma omp teams distribute parallel for
7963   for (int i = 0; i < 10; ++i) {
7964 #pragma omp parallel for simd // OK
7965     for (int i = 0; i < 10; ++i)
7966       ;
7967   }
7968 #pragma omp target
7969 #pragma omp teams distribute parallel for
7970   for (int i = 0; i < 10; ++i) {
7971 #pragma omp parallel sections // OK
7972     {
7973       bar();
7974     }
7975   }
7976 #pragma omp target
7977 #pragma omp teams distribute parallel for
7978   for (int i = 0; i < 10; ++i) {
7979 #pragma omp task // OK
7980     {
7981       bar();
7982     }
7983   }
7984 #pragma omp target
7985 #pragma omp teams distribute parallel for
7986   for (int i = 0; i < 10; ++i) {
7987 #pragma omp taskyield // OK
7988     bar();
7989   }
7990 #pragma omp target
7991 #pragma omp teams distribute parallel for
7992   for (int i = 0; i < 10; ++i) {
7993 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region}}
7994     bar();
7995   }
7996 #pragma omp target
7997 #pragma omp teams distribute parallel for
7998   for (int i = 0; i < 10; ++i) {
7999 #pragma omp taskwait // OK
8000     bar();
8001   }
8002 #pragma omp target
8003 #pragma omp teams distribute parallel for
8004   for (int i = 0; i < 10; ++i) {
8005 #pragma omp flush // OK
8006     bar();
8007   }
8008 #pragma omp target
8009 #pragma omp teams distribute parallel for
8010   for (int i = 0; i < 10; ++i) {
8011 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
8012     bar();
8013   }
8014 #pragma omp target
8015 #pragma omp teams distribute parallel for
8016   for (int i = 0; i < 10; ++i) {
8017 #pragma omp atomic // OK
8018     ++a;
8019   }
8020 #pragma omp target
8021 #pragma omp teams distribute parallel for
8022   for (int i = 0; i < 10; ++i) {
8023 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
8024     ++a;
8025   }
8026 #pragma omp target
8027 #pragma omp teams distribute parallel for
8028   for (int i = 0; i < 10; ++i) {
8029 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
8030     ++a;
8031   }
8032 #pragma omp target
8033 #pragma omp teams distribute parallel for
8034   for (int i = 0; i < 10; ++i) {
8035 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
8036     for (int i = 0; i < 10; ++i)
8037       ;
8038   }
8039 #pragma omp target
8040 #pragma omp teams distribute parallel for
8041   for (int i = 0; i < 10; ++i) {
8042 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
8043     ++a;
8044   }
8045 #pragma omp target
8046 #pragma omp teams distribute parallel for
8047   for (int i = 0; i < 10; ++i) {
8048 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
8049     ++a;
8050   }
8051 #pragma omp target
8052 #pragma omp teams distribute parallel for
8053   for (int i = 0; i < 10; ++i) {
8054 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
8055     ++a;
8056   }
8057 #pragma omp target
8058 #pragma omp teams distribute parallel for
8059   for (int i = 0; i < 10; ++i) {
8060 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
8061     ++a;
8062   }
8063 #pragma omp target
8064 #pragma omp teams distribute parallel for
8065   for (int i = 0; i < 10; ++i) {
8066 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
8067     for (int i = 0; i < 10; ++i)
8068       ++a;
8069   }
8070 #pragma omp target
8071 #pragma omp teams distribute parallel for
8072   for (int i = 0; i < 10; ++i) {
8073 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
8074     for (int i = 0; i < 10; ++i)
8075       ++a;
8076   }
8077 #pragma omp target
8078 #pragma omp teams distribute parallel for
8079   for (int i = 0; i < 10; ++i) {
8080 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
8081     for (int i = 0; i < 10; ++i)
8082       ++a;
8083   }
8084 #pragma omp target
8085 #pragma omp teams distribute parallel for
8086   for (int i = 0; i < 10; ++i) {
8087 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
8088     for (int i = 0; i < 10; ++i)
8089       ++a;
8090   }
8091 #pragma omp target
8092 #pragma omp teams distribute parallel for
8093   for (int i = 0; i < 10; ++i) {
8094 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
8095     for (int i = 0; i < 10; ++i)
8096       ++a;
8097   }
8098 #pragma omp target
8099 #pragma omp teams distribute parallel for
8100   for (int i = 0; i < 10; ++i) {
8101 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
8102     for (int i = 0; i < 10; ++i)
8103       ++a;
8104   }
8105 #pragma omp target
8106 #pragma omp teams distribute parallel for
8107   for (int i = 0; i < 10; ++i) {
8108 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
8109     ++a;
8110   }
8111 #pragma omp target
8112 #pragma omp teams distribute parallel for
8113   for (int i = 0; i < 10; ++i) {
8114 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
8115     for (int i = 0; i < 10; ++i)
8116       ++a;
8117   }
8118 #pragma omp target
8119 #pragma omp teams distribute parallel for
8120   for (int i = 0; i < 10; ++i) {
8121 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
8122     for (int i = 0; i < 10; ++i)
8123       ++a;
8124   }
8125 #pragma omp target
8126 #pragma omp teams distribute parallel for
8127   for (int i = 0; i < 10; ++i) {
8128 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
8129     for (int i = 0; i < 10; ++i)
8130       ++a;
8131   }
8132 #pragma omp target
8133 #pragma omp teams distribute parallel for
8134   for (int i = 0; i < 10; ++i) {
8135 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
8136     for (int i = 0; i < 10; ++i)
8137       ++a;
8138   }
8139 
8140 // TARGET TEAMS DIRECTIVE
8141 #pragma omp target teams
8142 #pragma omp parallel
8143   bar();
8144 #pragma omp target teams
8145 #pragma omp for // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
8146   for (int i = 0; i < 10; ++i)
8147     ;
8148 #pragma omp target teams
8149 #pragma omp simd // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp simd' directive into a parallel region?}}
8150   for (int i = 0; i < 10; ++i)
8151     ;
8152 #pragma omp target teams
8153 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
8154   for (int i = 0; i < 10; ++i)
8155     ;
8156 #pragma omp target teams
8157 #pragma omp sections // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
8158   {
8159     bar();
8160   }
8161 #pragma omp target teams
8162 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams region}}
8163   {
8164     bar();
8165   }
8166 #pragma omp target teams
8167 #pragma omp single // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
8168   bar();
8169 
8170 #pragma omp target teams
8171 #pragma omp master // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp master' directive into a parallel region?}}
8172   {
8173     bar();
8174   }
8175 #pragma omp target teams
8176 #pragma omp critical // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp critical' directive into a parallel region?}}
8177   {
8178     bar();
8179   }
8180 #pragma omp target teams
8181 #pragma omp parallel for
8182   for (int i = 0; i < 10; ++i)
8183     ;
8184 #pragma omp target teams
8185 #pragma omp parallel for simd
8186   for (int i = 0; i < 10; ++i)
8187     ;
8188 #pragma omp target teams
8189 #pragma omp parallel sections
8190   {
8191     bar();
8192   }
8193 #pragma omp target teams
8194 #pragma omp task // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp task' directive into a parallel region?}}
8195   {
8196     bar();
8197   }
8198 #pragma omp target teams
8199   {
8200 #pragma omp taskyield // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp taskyield' directive into a parallel region?}}
8201     bar();
8202   }
8203 #pragma omp target teams
8204   {
8205 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp barrier' directive into a parallel region?}}
8206     bar();
8207   }
8208 #pragma omp target teams
8209   {
8210 #pragma omp taskwait // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp taskwait' directive into a parallel region?}}
8211     bar();
8212   }
8213 #pragma omp target teams
8214   {
8215 #pragma omp flush // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp flush' directive into a parallel region?}}
8216     bar();
8217   }
8218 #pragma omp target teams
8219   {
8220 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
8221     bar();
8222   }
8223 #pragma omp target teams
8224   {
8225 #pragma omp atomic // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp atomic' directive into a parallel region?}}
8226     ++a;
8227   }
8228 #pragma omp target teams
8229   {
8230 #pragma omp target // expected-error {{region cannot be nested inside 'target teams' region}}
8231     ++a;
8232   }
8233 #pragma omp target teams
8234   {
8235 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target teams' region}}
8236     ++a;
8237   }
8238 #pragma omp target teams
8239 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams' region}}
8240   for (int i = 0; i < 10; ++i)
8241     ;
8242 #pragma omp target teams
8243   {
8244 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams' region}}
8245   }
8246 #pragma omp target teams
8247   {
8248 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams' region}}
8249   }
8250 #pragma omp target teams
8251   {
8252 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
8253     ++a;
8254   }
8255 #pragma omp target teams
8256   {
8257 #pragma omp taskloop // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp taskloop' directive into a parallel region?}}
8258   for (int i = 0; i < 10; ++i)
8259     ++a;
8260   }
8261 #pragma omp target teams
8262 #pragma omp distribute
8263   for (int i = 0; i < 10; ++i)
8264     ;
8265 #pragma omp target teams
8266   {
8267 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams' region}}
8268     ++a;
8269   }
8270 #pragma omp target teams
8271 #pragma omp distribute parallel for
8272   for (int i = 0; i < 10; ++i)
8273     ;
8274 #pragma omp target teams
8275   {
8276 #pragma omp distribute parallel for
8277   for (int i = 0; i < 10; ++i)
8278     ;
8279 #pragma omp distribute parallel for
8280   for (int j = 0; j < 10; ++j)
8281     ;
8282   }
8283 #pragma omp target teams
8284   {
8285 #pragma omp distribute parallel for simd
8286   for (int i = 0; i < 10; ++i)
8287     ;
8288 #pragma omp distribute parallel for simd
8289   for (int j = 0; j < 10; ++j)
8290     ;
8291   }
8292 #pragma omp target teams
8293   {
8294 #pragma omp distribute simd
8295   for (int i = 0; i < 10; ++i)
8296     ;
8297 #pragma omp distribute simd
8298   for (int j = 0; j < 10; ++j)
8299     ;
8300   }
8301 #pragma omp target teams
8302   {
8303 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams' region}}
8304   for (int i = 0; i < 10; ++i)
8305     ;
8306   }
8307 #pragma omp target teams
8308   {
8309 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
8310   for (int i = 0; i < 10; ++i)
8311     ;
8312   }
8313 #pragma omp target teams
8314   {
8315 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
8316   for (int i = 0; i < 10; ++i)
8317     ;
8318   }
8319 #pragma omp target teams
8320   {
8321 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
8322   for (int i = 0; i < 10; ++i)
8323     ;
8324   }
8325 #pragma omp target teams
8326   {
8327 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
8328   for (int i = 0; i < 10; ++i)
8329     ;
8330   }
8331 #pragma omp target teams
8332   {
8333 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams' region}}
8334     a++;
8335   }
8336 #pragma omp target teams
8337   {
8338 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams' region}}
8339   for (int i = 0; i < 10; ++i)
8340     ;
8341   }
8342 #pragma omp target teams
8343   {
8344 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams' region}}
8345   for (int i = 0; i < 10; ++i)
8346     ;
8347   }
8348 #pragma omp target teams
8349   {
8350 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams' region}}
8351   for (int i = 0; i < 10; ++i)
8352     ;
8353   }
8354 #pragma omp target teams
8355   {
8356 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams' region}}
8357   for (int i = 0; i < 10; ++i)
8358     ;
8359   }
8360 
8361 // TARGET TEAMS DISTRIBUTE DIRECTIVE
8362 #pragma omp target teams distribute // OK
8363   for (int i = 0; i < 10; ++i)
8364     ;
8365 #pragma omp target teams distribute
8366   for (int i = 0; i < 10; ++i) {
8367 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
8368     for (int i = 0; i < 10; ++i)
8369       ;
8370   }
8371 #pragma omp target teams distribute
8372   for (int i = 0; i < 10; ++i) {
8373 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
8374     for (int i = 0; i < 10; ++i)
8375       ;
8376   }
8377 #pragma omp target teams distribute
8378   for (int i = 0; i < 10; ++i) {
8379 #pragma omp for // OK
8380     for (int i = 0; i < 10; ++i)
8381       ;
8382   }
8383 #pragma omp target teams distribute
8384   for (int i = 0; i < 10; ++i) {
8385 #pragma omp simd // OK
8386     for (int i = 0; i < 10; ++i)
8387       ;
8388   }
8389 #pragma omp target teams distribute
8390   for (int i = 0; i < 10; ++i) {
8391 #pragma omp for simd // OK
8392     for (int i = 0; i < 10; ++i)
8393       ;
8394   }
8395 #pragma omp target teams distribute
8396   for (int i = 0; i < 10; ++i) {
8397 #pragma omp parallel // OK
8398     for (int i = 0; i < 10; ++i)
8399       ;
8400   }
8401 #pragma omp target teams distribute
8402   for (int i = 0; i < 10; ++i) {
8403 #pragma omp sections // OK
8404     {
8405       bar();
8406     }
8407   }
8408 #pragma omp target teams distribute
8409   for (int i = 0; i < 10; ++i) {
8410 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams distribute region}}
8411     {
8412       bar();
8413     }
8414   }
8415 #pragma omp target teams distribute
8416   for (int i = 0; i < 10; ++i) {
8417 #pragma omp single // OK
8418     {
8419       bar();
8420     }
8421   }
8422 #pragma omp target teams distribute
8423   for (int i = 0; i < 10; ++i) {
8424 #pragma omp master // OK
8425     {
8426       bar();
8427     }
8428   }
8429 #pragma omp target teams distribute
8430   for (int i = 0; i < 10; ++i) {
8431 #pragma omp critical // OK
8432     {
8433       bar();
8434     }
8435   }
8436 #pragma omp target teams distribute
8437   for (int i = 0; i < 10; ++i) {
8438 #pragma omp parallel // OK
8439     {
8440 #pragma omp single
8441       {
8442         bar();
8443       }
8444     }
8445   }
8446 #pragma omp target teams distribute
8447   for (int i = 0; i < 10; ++i) {
8448 #pragma omp parallel for // OK
8449     for (int i = 0; i < 10; ++i)
8450       ;
8451   }
8452 #pragma omp target teams distribute
8453   for (int i = 0; i < 10; ++i) {
8454 #pragma omp parallel for simd // OK
8455     for (int i = 0; i < 10; ++i)
8456       ;
8457   }
8458 #pragma omp target teams distribute
8459   for (int i = 0; i < 10; ++i) {
8460 #pragma omp parallel sections // OK
8461     {
8462       bar();
8463     }
8464   }
8465 #pragma omp target teams distribute
8466   for (int i = 0; i < 10; ++i) {
8467 #pragma omp task // OK
8468     {
8469       bar();
8470     }
8471   }
8472 #pragma omp target teams distribute
8473   for (int i = 0; i < 10; ++i) {
8474 #pragma omp taskyield // OK
8475     bar();
8476   }
8477 #pragma omp target teams distribute
8478   for (int i = 0; i < 10; ++i) {
8479 #pragma omp barrier // OK
8480     bar();
8481   }
8482 #pragma omp target teams distribute
8483   for (int i = 0; i < 10; ++i) {
8484 #pragma omp taskwait // OK
8485     bar();
8486   }
8487 #pragma omp target teams distribute
8488   for (int i = 0; i < 10; ++i) {
8489 #pragma omp flush // OK
8490     bar();
8491   }
8492 #pragma omp target teams distribute
8493   for (int i = 0; i < 10; ++i) {
8494 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
8495     bar();
8496   }
8497 #pragma omp target teams distribute
8498   for (int i = 0; i < 10; ++i) {
8499 #pragma omp atomic // OK
8500     ++a;
8501   }
8502 #pragma omp target teams distribute
8503   for (int i = 0; i < 10; ++i) {
8504 #pragma omp target // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8505     ++a;
8506   }
8507 #pragma omp target teams distribute
8508   for (int i = 0; i < 10; ++i) {
8509 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8510     ++a;
8511   }
8512 #pragma omp target teams distribute
8513   for (int i = 0; i < 10; ++i) {
8514 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8515     for (int i = 0; i < 10; ++i)
8516       ;
8517   }
8518 #pragma omp target teams distribute
8519   for (int i = 0; i < 10; ++i) {
8520 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8521     ++a;
8522   }
8523 #pragma omp target teams distribute
8524   for (int i = 0; i < 10; ++i) {
8525 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8526     ++a;
8527   }
8528 #pragma omp target teams distribute
8529   for (int i = 0; i < 10; ++i) {
8530 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
8531     ++a;
8532   }
8533 #pragma omp target teams distribute
8534   for (int i = 0; i < 10; ++i) {
8535 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8536     ++a;
8537   }
8538 #pragma omp target teams distribute
8539   for (int i = 0; i < 10; ++i) {
8540 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
8541     for (int i = 0; i < 10; ++i)
8542       ++a;
8543   }
8544 #pragma omp target teams distribute
8545   for (int i = 0; i < 10; ++i) {
8546 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8547     for (int i = 0; i < 10; ++i)
8548       ++a;
8549   }
8550 #pragma omp target teams distribute
8551   for (int i = 0; i < 10; ++i) {
8552 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
8553     for (int i = 0; i < 10; ++i)
8554       ++a;
8555   }
8556 #pragma omp target teams distribute
8557   for (int i = 0; i < 10; ++i) {
8558 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
8559     for (int i = 0; i < 10; ++i)
8560       ++a;
8561   }
8562 #pragma omp target teams distribute
8563   for (int i = 0; i < 10; ++i) {
8564 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
8565     for (int i = 0; i < 10; ++i)
8566       ++a;
8567   }
8568 #pragma omp target teams distribute
8569   for (int i = 0; i < 10; ++i) {
8570 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
8571     for (int i = 0; i < 10; ++i)
8572       ;
8573   }
8574 #pragma omp target teams distribute
8575   for (int i = 0; i < 10; ++i) {
8576 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8577     a++;
8578   }
8579 #pragma omp target teams distribute
8580   for (int i = 0; i < 10; ++i) {
8581 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8582     for (int i = 0; i < 10; ++i)
8583       ;
8584   }
8585 #pragma omp target teams distribute
8586   for (int i = 0; i < 10; ++i) {
8587 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8588     for (int i = 0; i < 10; ++i)
8589       ;
8590   }
8591 #pragma omp target teams distribute
8592   for (int i = 0; i < 10; ++i) {
8593 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8594     for (int i = 0; i < 10; ++i)
8595       ;
8596   }
8597 #pragma omp target teams distribute
8598   for (int i = 0; i < 10; ++i) {
8599 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8600     for (int i = 0; i < 10; ++i)
8601       ;
8602   }
8603 
8604 // TARGET TEAMS DISTRIBUTE PARALLEL FOR DIRECTIVE
8605 #pragma omp target teams distribute parallel for // OK
8606   for (int i = 0; i < 10; ++i)
8607     ;
8608 #pragma omp target teams distribute parallel for
8609   for (int i = 0; i < 10; ++i) {
8610 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
8611     for (int i = 0; i < 10; ++i)
8612       ;
8613   }
8614 #pragma omp target teams distribute parallel for
8615   for (int i = 0; i < 10; ++i) {
8616 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
8617     for (int i = 0; i < 10; ++i)
8618       ;
8619   }
8620 #pragma omp target teams distribute parallel for
8621   for (int i = 0; i < 10; ++i) {
8622 #pragma omp for // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
8623     for (int i = 0; i < 10; ++i)
8624       ;
8625   }
8626 #pragma omp target teams distribute parallel for
8627   for (int i = 0; i < 10; ++i) {
8628 #pragma omp simd // OK
8629     for (int i = 0; i < 10; ++i)
8630       ;
8631   }
8632 #pragma omp target teams distribute parallel for
8633   for (int i = 0; i < 10; ++i) {
8634 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
8635     for (int i = 0; i < 10; ++i)
8636       ;
8637   }
8638 #pragma omp target teams distribute parallel for
8639   for (int i = 0; i < 10; ++i) {
8640 #pragma omp parallel // OK
8641     for (int i = 0; i < 10; ++i)
8642       ;
8643   }
8644 #pragma omp target teams distribute parallel for
8645   for (int i = 0; i < 10; ++i) {
8646 #pragma omp sections // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
8647     {
8648       bar();
8649     }
8650   }
8651 #pragma omp target teams distribute parallel for
8652   for (int i = 0; i < 10; ++i) {
8653 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams distribute parallel for region}}
8654     {
8655       bar();
8656     }
8657   }
8658 #pragma omp target teams distribute parallel for
8659   for (int i = 0; i < 10; ++i) {
8660 #pragma omp single // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
8661     {
8662       bar();
8663     }
8664   }
8665 #pragma omp target teams distribute parallel for
8666   for (int i = 0; i < 10; ++i) {
8667 #pragma omp master // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
8668     {
8669       bar();
8670     }
8671   }
8672 #pragma omp target teams distribute parallel for
8673   for (int i = 0; i < 10; ++i) {
8674 #pragma omp critical // OK
8675     {
8676       bar();
8677     }
8678   }
8679 #pragma omp target teams distribute parallel for
8680   for (int i = 0; i < 10; ++i) {
8681 #pragma omp parallel // OK
8682     {
8683 #pragma omp single
8684       {
8685         bar();
8686       }
8687     }
8688   }
8689 #pragma omp target teams distribute parallel for
8690   for (int i = 0; i < 10; ++i) {
8691 #pragma omp parallel for // OK
8692     for (int i = 0; i < 10; ++i)
8693       ;
8694   }
8695 #pragma omp target teams distribute parallel for
8696   for (int i = 0; i < 10; ++i) {
8697 #pragma omp parallel for simd // OK
8698     for (int i = 0; i < 10; ++i)
8699       ;
8700   }
8701 #pragma omp target teams distribute parallel for
8702   for (int i = 0; i < 10; ++i) {
8703 #pragma omp parallel sections // OK
8704     {
8705       bar();
8706     }
8707   }
8708 #pragma omp target teams distribute parallel for
8709   for (int i = 0; i < 10; ++i) {
8710 #pragma omp task // OK
8711     {
8712       bar();
8713     }
8714   }
8715 #pragma omp target teams distribute parallel for
8716   for (int i = 0; i < 10; ++i) {
8717 #pragma omp taskyield // OK
8718     bar();
8719   }
8720 #pragma omp target teams distribute parallel for
8721   for (int i = 0; i < 10; ++i) {
8722 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
8723     bar();
8724   }
8725 #pragma omp target teams distribute parallel for
8726   for (int i = 0; i < 10; ++i) {
8727 #pragma omp taskwait // OK
8728     bar();
8729   }
8730 #pragma omp target teams distribute parallel for
8731   for (int i = 0; i < 10; ++i) {
8732 #pragma omp flush // OK
8733     bar();
8734   }
8735 #pragma omp target teams distribute parallel for
8736   for (int i = 0; i < 10; ++i) {
8737 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
8738     bar();
8739   }
8740 #pragma omp target teams distribute parallel for
8741   for (int i = 0; i < 10; ++i) {
8742 #pragma omp atomic // OK
8743     ++a;
8744   }
8745 #pragma omp target teams distribute parallel for
8746   for (int i = 0; i < 10; ++i) {
8747 #pragma omp target // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8748     ++a;
8749   }
8750 #pragma omp target teams distribute parallel for
8751   for (int i = 0; i < 10; ++i) {
8752 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8753     ++a;
8754   }
8755 #pragma omp target teams distribute parallel for
8756   for (int i = 0; i < 10; ++i) {
8757 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8758     for (int i = 0; i < 10; ++i)
8759       ;
8760   }
8761 #pragma omp target teams distribute parallel for
8762   for (int i = 0; i < 10; ++i) {
8763 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8764     ++a;
8765   }
8766 #pragma omp target teams distribute parallel for
8767   for (int i = 0; i < 10; ++i) {
8768 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8769     ++a;
8770   }
8771 #pragma omp target teams distribute parallel for
8772   for (int i = 0; i < 10; ++i) {
8773 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
8774     ++a;
8775   }
8776 #pragma omp target teams distribute parallel for
8777   for (int i = 0; i < 10; ++i) {
8778 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8779     ++a;
8780   }
8781 #pragma omp target teams distribute parallel for
8782   for (int i = 0; i < 10; ++i) {
8783 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
8784     for (int i = 0; i < 10; ++i)
8785       ++a;
8786   }
8787 #pragma omp target teams distribute parallel for
8788   for (int i = 0; i < 10; ++i) {
8789 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8790     for (int i = 0; i < 10; ++i)
8791       ++a;
8792   }
8793 #pragma omp target teams distribute parallel for
8794   for (int i = 0; i < 10; ++i) {
8795 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
8796     for (int i = 0; i < 10; ++i)
8797       ++a;
8798   }
8799 #pragma omp target teams distribute parallel for
8800   for (int i = 0; i < 10; ++i) {
8801 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
8802     for (int i = 0; i < 10; ++i)
8803       ++a;
8804   }
8805 #pragma omp target teams distribute parallel for
8806   for (int i = 0; i < 10; ++i) {
8807 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
8808     for (int i = 0; i < 10; ++i)
8809       ++a;
8810   }
8811 #pragma omp target teams distribute parallel for
8812   for (int i = 0; i < 10; ++i) {
8813 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
8814     for (int i = 0; i < 10; ++i)
8815       ;
8816   }
8817 #pragma omp target teams distribute parallel for
8818   for (int i = 0; i < 10; ++i) {
8819 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8820     a++;
8821   }
8822 #pragma omp target teams distribute parallel for
8823   for (int i = 0; i < 10; ++i) {
8824 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8825     for (int i = 0; i < 10; ++i)
8826       ;
8827   }
8828 #pragma omp target teams distribute parallel for
8829   for (int i = 0; i < 10; ++i) {
8830 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8831     for (int i = 0; i < 10; ++i)
8832       ;
8833   }
8834 #pragma omp target teams distribute parallel for
8835   for (int i = 0; i < 10; ++i) {
8836 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8837     for (int i = 0; i < 10; ++i)
8838       ;
8839   }
8840 #pragma omp target teams distribute parallel for
8841   for (int i = 0; i < 10; ++i) {
8842 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8843     for (int i = 0; i < 10; ++i)
8844       ;
8845   }
8846 
8847 // TARGET TEAMS DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
8848 #pragma omp target teams distribute parallel for simd // OK
8849   for (int i = 0; i < 10; ++i)
8850     ;
8851 #pragma omp target teams distribute parallel for simd
8852   for (int i = 0; i < 10; ++i) {
8853 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8854     for (int i = 0; i < 10; ++i)
8855       ;
8856   }
8857 #pragma omp target teams distribute parallel for simd
8858   for (int i = 0; i < 10; ++i) {
8859 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8860     for (int i = 0; i < 10; ++i)
8861       ;
8862   }
8863 #pragma omp target teams distribute parallel for simd
8864   for (int i = 0; i < 10; ++i) {
8865 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8866     for (int i = 0; i < 10; ++i)
8867       ;
8868   }
8869 #pragma omp target teams distribute parallel for simd
8870   for (int i = 0; i < 10; ++i) {
8871 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
8872     for (int i = 0; i < 10; ++i)
8873       ;
8874   }
8875 #pragma omp target teams distribute parallel for simd
8876   for (int i = 0; i < 10; ++i) {
8877 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8878     for (int i = 0; i < 10; ++i)
8879       ;
8880   }
8881 #pragma omp target teams distribute parallel for simd
8882   for (int i = 0; i < 10; ++i) {
8883 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8884     for (int i = 0; i < 10; ++i)
8885       ;
8886   }
8887 #pragma omp target teams distribute parallel for simd
8888   for (int i = 0; i < 10; ++i) {
8889 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8890     {
8891       bar();
8892     }
8893   }
8894 #pragma omp target teams distribute parallel for simd
8895   for (int i = 0; i < 10; ++i) {
8896 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8897     {
8898       bar();
8899     }
8900   }
8901 #pragma omp target teams distribute parallel for simd
8902   for (int i = 0; i < 10; ++i) {
8903 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8904     {
8905       bar();
8906     }
8907   }
8908 #pragma omp target teams distribute parallel for simd
8909   for (int i = 0; i < 10; ++i) {
8910 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8911     {
8912       bar();
8913     }
8914   }
8915 #pragma omp target teams distribute parallel for simd
8916   for (int i = 0; i < 10; ++i) {
8917 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8918     {
8919       bar();
8920     }
8921   }
8922 #pragma omp target teams distribute parallel for simd
8923   for (int i = 0; i < 10; ++i) {
8924 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8925     {
8926 #pragma omp single
8927       {
8928         bar();
8929       }
8930     }
8931   }
8932 #pragma omp target teams distribute parallel for simd
8933   for (int i = 0; i < 10; ++i) {
8934 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8935     for (int i = 0; i < 10; ++i)
8936       ;
8937   }
8938 #pragma omp target teams distribute parallel for simd
8939   for (int i = 0; i < 10; ++i) {
8940 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8941     for (int i = 0; i < 10; ++i)
8942       ;
8943   }
8944 #pragma omp target teams distribute parallel for simd
8945   for (int i = 0; i < 10; ++i) {
8946 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8947     {
8948       bar();
8949     }
8950   }
8951 #pragma omp target teams distribute parallel for simd
8952   for (int i = 0; i < 10; ++i) {
8953 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8954     {
8955       bar();
8956     }
8957   }
8958 #pragma omp target teams distribute parallel for simd
8959   for (int i = 0; i < 10; ++i) {
8960 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8961     bar();
8962   }
8963 #pragma omp target teams distribute parallel for simd
8964   for (int i = 0; i < 10; ++i) {
8965 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8966     bar();
8967   }
8968 #pragma omp target teams distribute parallel for simd
8969   for (int i = 0; i < 10; ++i) {
8970 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8971     bar();
8972   }
8973 #pragma omp target teams distribute parallel for simd
8974   for (int i = 0; i < 10; ++i) {
8975 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8976     bar();
8977   }
8978 #pragma omp target teams distribute parallel for simd
8979   for (int i = 0; i < 10; ++i) {
8980 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8981     bar();
8982   }
8983 #pragma omp target teams distribute parallel for simd
8984   for (int i = 0; i < 10; ++i) {
8985 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}OK
8986     ++a;
8987   }
8988 #pragma omp target teams distribute parallel for simd
8989   for (int i = 0; i < 10; ++i) {
8990 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8991     ++a;
8992   }
8993 #pragma omp target teams distribute parallel for simd
8994   for (int i = 0; i < 10; ++i) {
8995 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8996     ++a;
8997   }
8998 #pragma omp target teams distribute parallel for simd
8999   for (int i = 0; i < 10; ++i) {
9000 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9001     for (int i = 0; i < 10; ++i)
9002       ;
9003   }
9004 #pragma omp target teams distribute parallel for simd
9005   for (int i = 0; i < 10; ++i) {
9006 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9007     ++a;
9008   }
9009 #pragma omp target teams distribute parallel for simd
9010   for (int i = 0; i < 10; ++i) {
9011 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9012     ++a;
9013   }
9014 #pragma omp target teams distribute parallel for simd
9015   for (int i = 0; i < 10; ++i) {
9016 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9017     ++a;
9018   }
9019 #pragma omp target teams distribute parallel for simd
9020   for (int i = 0; i < 10; ++i) {
9021 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9022     ++a;
9023   }
9024 #pragma omp target teams distribute parallel for simd
9025   for (int i = 0; i < 10; ++i) {
9026 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9027     for (int i = 0; i < 10; ++i)
9028       ++a;
9029   }
9030 #pragma omp target teams distribute parallel for simd
9031   for (int i = 0; i < 10; ++i) {
9032 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9033     for (int i = 0; i < 10; ++i)
9034       ++a;
9035   }
9036 #pragma omp target teams distribute parallel for simd
9037   for (int i = 0; i < 10; ++i) {
9038 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9039     for (int i = 0; i < 10; ++i)
9040       ++a;
9041   }
9042 #pragma omp target teams distribute parallel for simd
9043   for (int i = 0; i < 10; ++i) {
9044 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9045     for (int i = 0; i < 10; ++i)
9046       ++a;
9047   }
9048 #pragma omp target teams distribute parallel for simd
9049   for (int i = 0; i < 10; ++i) {
9050 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9051     for (int i = 0; i < 10; ++i)
9052       ++a;
9053   }
9054 #pragma omp target teams distribute parallel for simd
9055   for (int i = 0; i < 10; ++i) {
9056 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9057     for (int i = 0; i < 10; ++i)
9058       ;
9059   }
9060 #pragma omp target teams distribute parallel for simd
9061   for (int i = 0; i < 10; ++i) {
9062 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9063     a++;
9064   }
9065 #pragma omp target teams distribute parallel for simd
9066   for (int i = 0; i < 10; ++i) {
9067 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9068     for (int i = 0; i < 10; ++i)
9069       ;
9070   }
9071 #pragma omp target teams distribute parallel for simd
9072   for (int i = 0; i < 10; ++i) {
9073 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9074     for (int i = 0; i < 10; ++i)
9075       ;
9076   }
9077 #pragma omp target teams distribute parallel for simd
9078   for (int i = 0; i < 10; ++i) {
9079 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9080     for (int i = 0; i < 10; ++i)
9081       ;
9082   }
9083 #pragma omp target teams distribute parallel for simd
9084   for (int i = 0; i < 10; ++i) {
9085 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9086     for (int i = 0; i < 10; ++i)
9087       ;
9088   }
9089 
9090 // TARGET TEAMS DISTRIBUTE SIMD DIRECTIVE
9091 #pragma omp target teams distribute simd // OK
9092   for (int i = 0; i < 10; ++i)
9093     ;
9094 #pragma omp target teams distribute simd
9095   for (int i = 0; i < 10; ++i) {
9096 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9097     for (int i = 0; i < 10; ++i)
9098       ;
9099   }
9100 #pragma omp target teams distribute simd
9101   for (int i = 0; i < 10; ++i) {
9102 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9103     for (int i = 0; i < 10; ++i)
9104       ;
9105   }
9106 #pragma omp target teams distribute simd
9107   for (int i = 0; i < 10; ++i) {
9108 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9109     for (int i = 0; i < 10; ++i)
9110       ;
9111   }
9112 #pragma omp target teams distribute simd
9113   for (int i = 0; i < 10; ++i) {
9114 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
9115     for (int i = 0; i < 10; ++i)
9116       ;
9117   }
9118 #pragma omp target teams distribute simd
9119   for (int i = 0; i < 10; ++i) {
9120 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9121     for (int i = 0; i < 10; ++i)
9122       ;
9123   }
9124 #pragma omp target teams distribute simd
9125   for (int i = 0; i < 10; ++i) {
9126 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9127     for (int i = 0; i < 10; ++i)
9128       ;
9129   }
9130 #pragma omp target teams distribute simd
9131   for (int i = 0; i < 10; ++i) {
9132 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9133     {
9134       bar();
9135     }
9136   }
9137 #pragma omp target teams distribute simd
9138   for (int i = 0; i < 10; ++i) {
9139 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9140     {
9141       bar();
9142     }
9143   }
9144 #pragma omp target teams distribute simd
9145   for (int i = 0; i < 10; ++i) {
9146 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9147     {
9148       bar();
9149     }
9150   }
9151 #pragma omp target teams distribute simd
9152   for (int i = 0; i < 10; ++i) {
9153 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9154     {
9155       bar();
9156     }
9157   }
9158 #pragma omp target teams distribute simd
9159   for (int i = 0; i < 10; ++i) {
9160 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9161     {
9162       bar();
9163     }
9164   }
9165 #pragma omp target teams distribute simd
9166   for (int i = 0; i < 10; ++i) {
9167 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9168     {
9169 #pragma omp single
9170       {
9171         bar();
9172       }
9173     }
9174   }
9175 #pragma omp target teams distribute simd
9176   for (int i = 0; i < 10; ++i) {
9177 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9178     for (int i = 0; i < 10; ++i)
9179       ;
9180   }
9181 #pragma omp target teams distribute simd
9182   for (int i = 0; i < 10; ++i) {
9183 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9184     for (int i = 0; i < 10; ++i)
9185       ;
9186   }
9187 #pragma omp target teams distribute simd
9188   for (int i = 0; i < 10; ++i) {
9189 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9190     {
9191       bar();
9192     }
9193   }
9194 #pragma omp target teams distribute simd
9195   for (int i = 0; i < 10; ++i) {
9196 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9197     {
9198       bar();
9199     }
9200   }
9201 #pragma omp target teams distribute simd
9202   for (int i = 0; i < 10; ++i) {
9203 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9204     bar();
9205   }
9206 #pragma omp target teams distribute simd
9207   for (int i = 0; i < 10; ++i) {
9208 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9209     bar();
9210   }
9211 #pragma omp target teams distribute simd
9212   for (int i = 0; i < 10; ++i) {
9213 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9214     bar();
9215   }
9216 #pragma omp target teams distribute simd
9217   for (int i = 0; i < 10; ++i) {
9218 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9219     bar();
9220   }
9221 #pragma omp target teams distribute simd
9222   for (int i = 0; i < 10; ++i) {
9223 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9224     bar();
9225   }
9226 #pragma omp target teams distribute simd
9227   for (int i = 0; i < 10; ++i) {
9228 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}OK
9229     ++a;
9230   }
9231 #pragma omp target teams distribute simd
9232   for (int i = 0; i < 10; ++i) {
9233 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9234     ++a;
9235   }
9236 #pragma omp target teams distribute simd
9237   for (int i = 0; i < 10; ++i) {
9238 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9239     ++a;
9240   }
9241 #pragma omp target teams distribute simd
9242   for (int i = 0; i < 10; ++i) {
9243 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9244     for (int i = 0; i < 10; ++i)
9245       ;
9246   }
9247 #pragma omp target teams distribute simd
9248   for (int i = 0; i < 10; ++i) {
9249 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9250     ++a;
9251   }
9252 #pragma omp target teams distribute simd
9253   for (int i = 0; i < 10; ++i) {
9254 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9255     ++a;
9256   }
9257 #pragma omp target teams distribute simd
9258   for (int i = 0; i < 10; ++i) {
9259 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9260     ++a;
9261   }
9262 #pragma omp target teams distribute simd
9263   for (int i = 0; i < 10; ++i) {
9264 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9265     ++a;
9266   }
9267 #pragma omp target teams distribute simd
9268   for (int i = 0; i < 10; ++i) {
9269 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9270     for (int i = 0; i < 10; ++i)
9271       ++a;
9272   }
9273 #pragma omp target teams distribute simd
9274   for (int i = 0; i < 10; ++i) {
9275 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9276     for (int i = 0; i < 10; ++i)
9277       ++a;
9278   }
9279 #pragma omp target teams distribute simd
9280   for (int i = 0; i < 10; ++i) {
9281 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9282     for (int i = 0; i < 10; ++i)
9283       ++a;
9284   }
9285 #pragma omp target teams distribute simd
9286   for (int i = 0; i < 10; ++i) {
9287 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9288     for (int i = 0; i < 10; ++i)
9289       ++a;
9290   }
9291 #pragma omp target teams distribute simd
9292   for (int i = 0; i < 10; ++i) {
9293 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9294     for (int i = 0; i < 10; ++i)
9295       ++a;
9296   }
9297 #pragma omp target teams distribute simd
9298   for (int i = 0; i < 10; ++i) {
9299 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9300     for (int i = 0; i < 10; ++i)
9301       ;
9302   }
9303 #pragma omp target teams distribute simd
9304   for (int i = 0; i < 10; ++i) {
9305 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9306     a++;
9307   }
9308 #pragma omp target teams distribute simd
9309   for (int i = 0; i < 10; ++i) {
9310 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9311     for (int i = 0; i < 10; ++i)
9312       ;
9313   }
9314 #pragma omp target teams distribute simd
9315   for (int i = 0; i < 10; ++i) {
9316 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9317     for (int i = 0; i < 10; ++i)
9318       ;
9319   }
9320 #pragma omp target teams distribute simd
9321   for (int i = 0; i < 10; ++i) {
9322 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9323     for (int i = 0; i < 10; ++i)
9324       ;
9325   }
9326 #pragma omp target teams distribute simd
9327   for (int i = 0; i < 10; ++i) {
9328 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9329     for (int i = 0; i < 10; ++i)
9330       ;
9331   }
9332 
9333 }
9334 
foo()9335 void foo() {
9336   int a = 0;
9337 // PARALLEL DIRECTIVE
9338 #pragma omp parallel
9339 #pragma omp for
9340   for (int i = 0; i < 10; ++i)
9341     ;
9342 #pragma omp parallel
9343 #pragma omp simd
9344   for (int i = 0; i < 10; ++i)
9345     ;
9346 #pragma omp parallel
9347 #pragma omp for simd
9348   for (int i = 0; i < 10; ++i)
9349     ;
9350 #pragma omp parallel
9351 #pragma omp sections
9352   {
9353     bar();
9354   }
9355 #pragma omp parallel
9356 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel region}}
9357   {
9358     bar();
9359   }
9360 #pragma omp parallel
9361 #pragma omp sections
9362   {
9363     bar();
9364   }
9365 #pragma omp parallel
9366 #pragma omp single
9367   bar();
9368 #pragma omp parallel
9369 #pragma omp master
9370   bar();
9371 #pragma omp parallel master
9372   bar();
9373 #pragma omp parallel
9374 #pragma omp critical
9375   bar();
9376 #pragma omp parallel
9377 #pragma omp parallel for
9378   for (int i = 0; i < 10; ++i)
9379     ;
9380 #pragma omp parallel
9381 #pragma omp parallel for simd
9382   for (int i = 0; i < 10; ++i)
9383     ;
9384 #pragma omp parallel
9385 #pragma omp parallel sections
9386   {
9387     bar();
9388   }
9389 #pragma omp parallel
9390 #pragma omp task
9391   {
9392     bar();
9393   }
9394 #pragma omp parallel
9395   {
9396 #pragma omp taskyield
9397     bar();
9398   }
9399 #pragma omp parallel
9400   {
9401 #pragma omp barrier
9402     bar();
9403   }
9404 #pragma omp parallel
9405   {
9406 #pragma omp taskwait
9407     bar();
9408   }
9409 #pragma omp parallel
9410   {
9411 #pragma omp flush
9412     bar();
9413   }
9414 #pragma omp parallel
9415   {
9416 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
9417     bar();
9418   }
9419 #pragma omp parallel
9420   {
9421 #pragma omp atomic
9422     ++a;
9423   }
9424 #pragma omp parallel
9425   {
9426 #pragma omp target
9427     ++a;
9428   }
9429 #pragma omp parallel
9430   {
9431 #pragma omp target parallel
9432     ++a;
9433   }
9434 #pragma omp parallel
9435 #pragma omp target parallel for
9436   for (int i = 0; i < 10; ++i)
9437     ;
9438 #pragma omp parallel
9439   {
9440 #pragma omp target enter data map(to: a)
9441     ++a;
9442   }
9443 #pragma omp parallel
9444   {
9445 #pragma omp target exit data map(from: a)
9446     ++a;
9447   }
9448 #pragma omp parallel
9449   {
9450 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
9451     ++a;
9452   }
9453 #pragma omp parallel
9454   {
9455 #pragma omp taskloop
9456   for (int i = 0; i < 10; ++i)
9457     ++a;
9458   }
9459 #pragma omp parallel
9460   {
9461 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
9462     for (int i = 0; i < 10; ++i)
9463       ;
9464   }
9465 #pragma omp parallel
9466   {
9467 #pragma omp target update to(a)
9468     a++;
9469   }
9470 #pragma omp parallel
9471   {
9472 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
9473     for (int i = 0; i < 10; ++i)
9474       ;
9475   }
9476 #pragma omp parallel
9477   {
9478 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
9479     for (int i = 0; i < 10; ++i)
9480       ;
9481   }
9482 #pragma omp parallel
9483   {
9484 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
9485     for (int i = 0; i < 10; ++i)
9486       ;
9487   }
9488 #pragma omp parallel
9489   {
9490 #pragma omp target simd // OK
9491     for (int i = 0; i < 10; ++i)
9492       ;
9493   }
9494 #pragma omp parallel
9495   {
9496 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
9497     for (int i = 0; i < 10; ++i)
9498       ;
9499   }
9500 #pragma omp parallel
9501   {
9502 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
9503     for (int i = 0; i < 10; ++i)
9504       ;
9505   }
9506 #pragma omp parallel
9507   {
9508 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
9509     for (int i = 0; i < 10; ++i)
9510       ;
9511   }
9512 #pragma omp parallel
9513   {
9514 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
9515     for (int i = 0; i < 10; ++i)
9516       ;
9517   }
9518 #pragma omp parallel
9519   {
9520 #pragma omp target teams // OK
9521     a++;
9522   }
9523 #pragma omp parallel
9524   {
9525 #pragma omp target teams distribute // OK
9526     for (int i = 0; i < 10; ++i)
9527       ;
9528   }
9529 #pragma omp parallel
9530   {
9531 #pragma omp target teams distribute parallel for // OK
9532     for (int i = 0; i < 10; ++i)
9533       ;
9534   }
9535 #pragma omp parallel
9536   {
9537 #pragma omp target teams distribute parallel for simd // OK
9538     for (int i = 0; i < 10; ++i)
9539       ;
9540   }
9541 #pragma omp parallel
9542   {
9543 #pragma omp target teams distribute simd // OK
9544     for (int i = 0; i < 10; ++i)
9545       ;
9546   }
9547 
9548 // SIMD DIRECTIVE
9549 #pragma omp simd
9550   for (int i = 0; i < 10; ++i) {
9551 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9552     for (int i = 0; i < 10; ++i)
9553       ;
9554   }
9555 #pragma omp simd
9556   for (int i = 0; i < 10; ++i) {
9557 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
9558     for (int i = 0; i < 10; ++i)
9559       ;
9560   }
9561 #pragma omp simd
9562   for (int i = 0; i < 10; ++i) {
9563 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9564     for (int i = 0; i < 10; ++i)
9565       ;
9566   }
9567 #pragma omp simd
9568   for (int i = 0; i < 10; ++i) {
9569 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9570     for (int i = 0; i < 10; ++i)
9571       ;
9572   }
9573 #pragma omp simd
9574   for (int i = 0; i < 10; ++i) {
9575 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9576     {
9577       bar();
9578     }
9579   }
9580 #pragma omp simd
9581   for (int i = 0; i < 10; ++i) {
9582 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9583     {
9584       bar();
9585     }
9586   }
9587 #pragma omp simd
9588   for (int i = 0; i < 10; ++i) {
9589 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9590     bar();
9591 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9592     bar();
9593   }
9594 #pragma omp simd
9595   for (int i = 0; i < 10; ++i) {
9596 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9597     bar();
9598 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9599     bar();
9600   }
9601 #pragma omp simd
9602   for (int i = 0; i < 10; ++i) {
9603 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9604     for (int i = 0; i < 10; ++i)
9605       ;
9606   }
9607 #pragma omp simd
9608   for (int i = 0; i < 10; ++i) {
9609 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9610     for (int i = 0; i < 10; ++i)
9611       ;
9612   }
9613 #pragma omp simd
9614   for (int i = 0; i < 10; ++i) {
9615 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9616     {
9617       bar();
9618     }
9619   }
9620 #pragma omp simd
9621   for (int i = 0; i < 10; ++i) {
9622 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9623     {
9624       bar();
9625     }
9626   }
9627 #pragma omp simd
9628   for (int i = 0; i < 10; ++i) {
9629 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9630     bar();
9631   }
9632 #pragma omp simd
9633   for (int i = 0; i < 10; ++i) {
9634 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9635     bar();
9636   }
9637 #pragma omp simd
9638   for (int i = 0; i < 10; ++i) {
9639 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9640     bar();
9641   }
9642 #pragma omp simd
9643   for (int i = 0; i < 10; ++i) {
9644 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9645     bar();
9646   }
9647 #pragma omp simd
9648   for (int i = 0; i < 10; ++i) {
9649 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9650     bar();
9651   }
9652 #pragma omp simd
9653   for (int i = 0; i < 10; ++i) {
9654 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
9655     ++a;
9656   }
9657 #pragma omp simd
9658   for (int i = 0; i < 10; ++i) {
9659 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9660     ++a;
9661   }
9662 #pragma omp simd
9663   for (int i = 0; i < 10; ++i) {
9664 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9665     ++a;
9666   }
9667 #pragma omp simd
9668   for (int i = 0; i < 10; ++i) {
9669 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9670     for (int i = 0; i < 10; ++i)
9671       ;
9672   }
9673 #pragma omp simd
9674   for (int i = 0; i < 10; ++i) {
9675 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9676     ++a;
9677   }
9678 #pragma omp simd
9679   for (int i = 0; i < 10; ++i) {
9680 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9681     ++a;
9682   }
9683 #pragma omp simd
9684   for (int i = 0; i < 10; ++i) {
9685 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9686     ++a;
9687   }
9688 #pragma omp simd
9689   for (int i = 0; i < 10; ++i) {
9690 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9691   for (int i = 0; i < 10; ++i)
9692     ++a;
9693   }
9694 #pragma omp simd
9695   for (int i = 0; i < 10; ++i) {
9696 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9697     for (int j = 0; j < 10; ++j)
9698       ;
9699   }
9700 #pragma omp simd
9701   for (int i = 0; i < 10; ++i) {
9702 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9703     a++;
9704   }
9705 #pragma omp simd
9706   for (int i = 0; i < 10; ++i) {
9707 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9708     for (int j = 0; j < 10; ++j)
9709       ;
9710   }
9711 #pragma omp simd
9712   for (int i = 0; i < 10; ++i) {
9713 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9714     for (int j = 0; j < 10; ++j)
9715       ;
9716   }
9717 #pragma omp simd
9718   for (int i = 0; i < 10; ++i) {
9719 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9720     for (int j = 0; j < 10; ++j)
9721       ;
9722   }
9723 #pragma omp simd
9724   for (int i = 0; i < 10; ++i) {
9725 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9726     for (int j = 0; j < 10; ++j)
9727       ;
9728   }
9729 #pragma omp simd
9730   for (int i = 0; i < 10; ++i) {
9731 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9732     for (int j = 0; j < 10; ++j)
9733       ;
9734   }
9735 #pragma omp simd
9736   for (int i = 0; i < 10; ++i) {
9737 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9738     for (int j = 0; j < 10; ++j)
9739       ;
9740   }
9741 #pragma omp simd
9742   for (int i = 0; i < 10; ++i) {
9743 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9744     for (int j = 0; j < 10; ++j)
9745       ;
9746   }
9747 #pragma omp simd
9748   for (int i = 0; i < 10; ++i) {
9749 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9750     for (int j = 0; j < 10; ++j)
9751       ;
9752   }
9753 #pragma omp simd
9754   for (int i = 0; i < 10; ++i) {
9755 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9756     a++;
9757   }
9758 #pragma omp simd
9759   for (int i = 0; i < 10; ++i) {
9760 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9761     for (int j = 0; j < 10; ++j)
9762       ;
9763   }
9764 #pragma omp simd
9765   for (int i = 0; i < 10; ++i) {
9766 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9767     for (int j = 0; j < 10; ++j)
9768       ;
9769   }
9770 #pragma omp simd
9771   for (int i = 0; i < 10; ++i) {
9772 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9773     for (int j = 0; j < 10; ++j)
9774       ;
9775   }
9776 #pragma omp simd
9777   for (int i = 0; i < 10; ++i) {
9778 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9779     for (int j = 0; j < 10; ++j)
9780       ;
9781   }
9782 
9783 // FOR DIRECTIVE
9784 #pragma omp for
9785   for (int i = 0; i < 10; ++i) {
9786 #pragma omp for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
9787     for (int i = 0; i < 10; ++i)
9788       ;
9789   }
9790 #pragma omp for
9791   for (int i = 0; i < 10; ++i) {
9792 #pragma omp simd
9793     for (int i = 0; i < 10; ++i)
9794       ;
9795   }
9796 #pragma omp for
9797   for (int i = 0; i < 10; ++i) {
9798 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
9799     for (int i = 0; i < 10; ++i)
9800       ;
9801   }
9802 #pragma omp for
9803   for (int i = 0; i < 10; ++i) {
9804 #pragma omp parallel
9805     for (int i = 0; i < 10; ++i)
9806       ;
9807   }
9808 #pragma omp for
9809   for (int i = 0; i < 10; ++i) {
9810 #pragma omp sections // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
9811     {
9812       bar();
9813     }
9814   }
9815 #pragma omp for
9816   for (int i = 0; i < 10; ++i) {
9817 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a for region}}
9818     {
9819       bar();
9820     }
9821   }
9822 #pragma omp for
9823   for (int i = 0; i < 10; ++i) {
9824 #pragma omp single // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
9825     bar();
9826 #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
9827     bar();
9828 #pragma omp critical
9829     bar();
9830   }
9831 #pragma omp for
9832   for (int i = 0; i < 10; ++i) {
9833 #pragma omp parallel
9834     {
9835 #pragma omp single // OK
9836       {
9837         bar();
9838       }
9839 #pragma omp for // OK
9840       for (int i = 0; i < 10; ++i)
9841         ;
9842 #pragma omp for simd // OK
9843       for (int i = 0; i < 10; ++i)
9844         ;
9845 #pragma omp sections // OK
9846       {
9847         bar();
9848       }
9849     }
9850   }
9851 #pragma omp for
9852   for (int i = 0; i < 10; ++i) {
9853 #pragma omp parallel for
9854     for (int i = 0; i < 10; ++i)
9855       ;
9856   }
9857 #pragma omp for
9858   for (int i = 0; i < 10; ++i) {
9859 #pragma omp parallel for simd
9860     for (int i = 0; i < 10; ++i)
9861       ;
9862   }
9863 #pragma omp for
9864   for (int i = 0; i < 10; ++i) {
9865 #pragma omp parallel sections
9866     {
9867       bar();
9868     }
9869   }
9870 #pragma omp for
9871   for (int i = 0; i < 10; ++i) {
9872 #pragma omp task
9873     {
9874       bar();
9875     }
9876   }
9877 #pragma omp for
9878   for (int i = 0; i < 10; ++i) {
9879 #pragma omp taskyield
9880     bar();
9881   }
9882 #pragma omp for
9883   for (int i = 0; i < 10; ++i) {
9884 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}}
9885     bar();
9886   }
9887 #pragma omp for
9888   for (int i = 0; i < 10; ++i) {
9889 #pragma omp taskwait
9890     bar();
9891   }
9892 #pragma omp for
9893   for (int i = 0; i < 10; ++i) {
9894 #pragma omp flush
9895     bar();
9896   }
9897 #pragma omp for
9898   for (int i = 0; i < 10; ++i) {
9899 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
9900     bar();
9901   }
9902 #pragma omp for ordered
9903   for (int i = 0; i < 10; ++i) {
9904 #pragma omp ordered // OK
9905     bar();
9906   }
9907 #pragma omp for
9908   for (int i = 0; i < 10; ++i) {
9909 #pragma omp atomic
9910     ++a;
9911   }
9912 #pragma omp for
9913   for (int i = 0; i < 10; ++i) {
9914 #pragma omp target
9915     ++a;
9916   }
9917 #pragma omp for
9918   for (int i = 0; i < 10; ++i) {
9919 #pragma omp target parallel
9920     ++a;
9921   }
9922 #pragma omp for
9923   for (int i = 0; i < 10; ++i) {
9924 #pragma omp target parallel for
9925     for (int i = 0; i < 10; ++i)
9926       ;
9927   }
9928 #pragma omp for
9929   for (int i = 0; i < 10; ++i) {
9930 #pragma omp target enter data map(to: a)
9931     ++a;
9932   }
9933 #pragma omp for
9934   for (int i = 0; i < 10; ++i) {
9935 #pragma omp target exit data map(from: a)
9936     ++a;
9937   }
9938 #pragma omp for
9939   for (int i = 0; i < 10; ++i) {
9940 #pragma omp teams // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
9941     ++a;
9942   }
9943 #pragma omp for
9944   for (int i = 0; i < 10; ++i) {
9945 #pragma omp taskloop
9946   for (int i = 0; i < 10; ++i)
9947     ++a;
9948   }
9949 #pragma omp for
9950   for (int i = 0; i < 10; ++i) {
9951 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
9952     for (int j = 0; j < 10; ++j)
9953       ;
9954   }
9955 #pragma omp for
9956   for (int i = 0; i < 10; ++i) {
9957 #pragma omp target update to(a)
9958     ++a;
9959   }
9960 #pragma omp for
9961   for (int i = 0; i < 10; ++i) {
9962 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
9963     for (int j = 0; j < 10; ++j)
9964       ;
9965   }
9966 #pragma omp for
9967   for (int i = 0; i < 10; ++i) {
9968 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
9969     for (int j = 0; j < 10; ++j)
9970       ;
9971   }
9972 #pragma omp for
9973   for (int i = 0; i < 10; ++i) {
9974 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
9975     for (int j = 0; j < 10; ++j)
9976       ;
9977   }
9978 #pragma omp for
9979   for (int i = 0; i < 10; ++i) {
9980 #pragma omp target simd // OK
9981     for (int j = 0; j < 10; ++j)
9982       ;
9983   }
9984 #pragma omp for
9985   for (int i = 0; i < 10; ++i) {
9986 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
9987     for (int j = 0; j < 10; ++j)
9988       ;
9989   }
9990 #pragma omp for
9991   for (int i = 0; i < 10; ++i) {
9992 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
9993     for (int j = 0; j < 10; ++j)
9994       ;
9995   }
9996 #pragma omp for
9997   for (int i = 0; i < 10; ++i) {
9998 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
9999     for (int j = 0; j < 10; ++j)
10000       ;
10001   }
10002 #pragma omp for
10003   for (int i = 0; i < 10; ++i) {
10004 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
10005     for (int j = 0; j < 10; ++j)
10006       ;
10007   }
10008 #pragma omp for
10009   for (int i = 0; i < 10; ++i) {
10010 #pragma omp target teams // OK
10011     a++;
10012   }
10013 #pragma omp for
10014   for (int i = 0; i < 10; ++i) {
10015 #pragma omp target teams distribute // OK
10016     for (int j = 0; j < 10; ++j)
10017       ;
10018   }
10019 #pragma omp for
10020   for (int i = 0; i < 10; ++i) {
10021 #pragma omp target teams distribute parallel for // OK
10022     for (int j = 0; j < 10; ++j)
10023       ;
10024   }
10025 #pragma omp for
10026   for (int i = 0; i < 10; ++i) {
10027 #pragma omp target teams distribute parallel for simd // OK
10028     for (int j = 0; j < 10; ++j)
10029       ;
10030   }
10031 #pragma omp for
10032   for (int i = 0; i < 10; ++i) {
10033 #pragma omp target teams distribute simd // OK
10034     for (int j = 0; j < 10; ++j)
10035       ;
10036   }
10037 
10038 // FOR SIMD DIRECTIVE
10039 #pragma omp for simd
10040   for (int i = 0; i < 10; ++i) {
10041 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10042     for (int i = 0; i < 10; ++i)
10043       ;
10044   }
10045 #pragma omp for simd
10046   for (int i = 0; i < 10; ++i) {
10047 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
10048     for (int i = 0; i < 10; ++i)
10049       ;
10050   }
10051 #pragma omp for simd
10052   for (int i = 0; i < 10; ++i) {
10053 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10054     for (int i = 0; i < 10; ++i)
10055       ;
10056   }
10057 #pragma omp for simd
10058   for (int i = 0; i < 10; ++i) {
10059 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10060     for (int i = 0; i < 10; ++i)
10061       ;
10062   }
10063 #pragma omp for simd
10064   for (int i = 0; i < 10; ++i) {
10065 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10066     {
10067       bar();
10068     }
10069   }
10070 #pragma omp for simd
10071   for (int i = 0; i < 10; ++i) {
10072 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10073     {
10074       bar();
10075     }
10076   }
10077 #pragma omp for simd
10078   for (int i = 0; i < 10; ++i) {
10079 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10080     bar();
10081 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10082     bar();
10083   }
10084 #pragma omp for simd
10085   for (int i = 0; i < 10; ++i) {
10086 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10087     bar();
10088 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10089     bar();
10090   }
10091 #pragma omp for simd
10092   for (int i = 0; i < 10; ++i) {
10093 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10094     for (int i = 0; i < 10; ++i)
10095       ;
10096   }
10097 #pragma omp for simd
10098   for (int i = 0; i < 10; ++i) {
10099 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10100     for (int i = 0; i < 10; ++i)
10101       ;
10102   }
10103 #pragma omp for simd
10104   for (int i = 0; i < 10; ++i) {
10105 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10106     {
10107       bar();
10108     }
10109   }
10110 #pragma omp for simd
10111   for (int i = 0; i < 10; ++i) {
10112 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10113     {
10114       bar();
10115     }
10116   }
10117 #pragma omp for simd
10118   for (int i = 0; i < 10; ++i) {
10119 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10120     bar();
10121   }
10122 #pragma omp for simd
10123   for (int i = 0; i < 10; ++i) {
10124 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10125     bar();
10126   }
10127 #pragma omp for simd
10128   for (int i = 0; i < 10; ++i) {
10129 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10130     bar();
10131   }
10132 #pragma omp for simd
10133   for (int i = 0; i < 10; ++i) {
10134 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10135     bar();
10136   }
10137 #pragma omp for simd
10138   for (int i = 0; i < 10; ++i) {
10139 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10140     bar();
10141   }
10142 #pragma omp for simd
10143   for (int i = 0; i < 10; ++i) {
10144 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
10145     ++a;
10146   }
10147 #pragma omp for simd
10148   for (int i = 0; i < 10; ++i) {
10149 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10150     ++a;
10151   }
10152 #pragma omp for simd
10153   for (int i = 0; i < 10; ++i) {
10154 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10155     ++a;
10156   }
10157 #pragma omp for simd
10158   for (int i = 0; i < 10; ++i) {
10159 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10160     for (int i = 0; i < 10; ++i)
10161       ;
10162   }
10163 #pragma omp for simd
10164   for (int i = 0; i < 10; ++i) {
10165 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10166     ++a;
10167   }
10168 #pragma omp for simd
10169   for (int i = 0; i < 10; ++i) {
10170 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10171     ++a;
10172   }
10173 #pragma omp for simd
10174   for (int i = 0; i < 10; ++i) {
10175 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10176     ++a;
10177   }
10178 #pragma omp for simd
10179   for (int i = 0; i < 10; ++i) {
10180 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10181   for (int i = 0; i < 10; ++i)
10182     ++a;
10183   }
10184 #pragma omp for simd
10185   for (int i = 0; i < 10; ++i) {
10186 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10187     for (int j = 0; j < 10; ++j)
10188       ;
10189   }
10190 #pragma omp for simd
10191   for (int i = 0; i < 10; ++i) {
10192 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10193     ++a;
10194   }
10195 #pragma omp for simd
10196   for (int i = 0; i < 10; ++i) {
10197 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10198     for (int j = 0; j < 10; ++j)
10199       ;
10200   }
10201 #pragma omp for simd
10202   for (int i = 0; i < 10; ++i) {
10203 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10204     for (int j = 0; j < 10; ++j)
10205       ;
10206   }
10207 #pragma omp for simd
10208   for (int i = 0; i < 10; ++i) {
10209 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10210     for (int j = 0; j < 10; ++j)
10211       ;
10212   }
10213 #pragma omp for simd
10214   for (int i = 0; i < 10; ++i) {
10215 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10216     for (int j = 0; j < 10; ++j)
10217       ;
10218   }
10219 #pragma omp for simd
10220   for (int i = 0; i < 10; ++i) {
10221 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10222     for (int j = 0; j < 10; ++j)
10223       ;
10224   }
10225 #pragma omp for simd
10226   for (int i = 0; i < 10; ++i) {
10227 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10228     for (int j = 0; j < 10; ++j)
10229       ;
10230   }
10231 #pragma omp for simd
10232   for (int i = 0; i < 10; ++i) {
10233 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10234     for (int j = 0; j < 10; ++j)
10235       ;
10236   }
10237 #pragma omp for simd
10238   for (int i = 0; i < 10; ++i) {
10239 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10240     for (int j = 0; j < 10; ++j)
10241       ;
10242   }
10243 #pragma omp for simd
10244   for (int i = 0; i < 10; ++i) {
10245 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10246     a++;
10247   }
10248 #pragma omp for simd
10249   for (int i = 0; i < 10; ++i) {
10250 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10251     for (int j = 0; j < 10; ++j)
10252       ;
10253   }
10254 #pragma omp for simd
10255   for (int i = 0; i < 10; ++i) {
10256 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10257     for (int j = 0; j < 10; ++j)
10258       ;
10259   }
10260 #pragma omp for simd
10261   for (int i = 0; i < 10; ++i) {
10262 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10263     for (int j = 0; j < 10; ++j)
10264       ;
10265   }
10266 #pragma omp for simd
10267   for (int i = 0; i < 10; ++i) {
10268 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
10269     for (int j = 0; j < 10; ++j)
10270       ;
10271   }
10272 
10273 // SECTIONS DIRECTIVE
10274 #pragma omp sections
10275   {
10276 #pragma omp for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
10277     for (int i = 0; i < 10; ++i)
10278       ;
10279   }
10280 #pragma omp sections
10281   {
10282 #pragma omp simd
10283     for (int i = 0; i < 10; ++i)
10284       ;
10285   }
10286 #pragma omp sections
10287   {
10288 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
10289     for (int i = 0; i < 10; ++i)
10290       ;
10291   }
10292 #pragma omp sections
10293   {
10294 #pragma omp parallel
10295     for (int i = 0; i < 10; ++i)
10296       ;
10297   }
10298 #pragma omp sections
10299   {
10300 #pragma omp sections // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
10301     {
10302       bar();
10303     }
10304   }
10305 #pragma omp sections
10306   {
10307 #pragma omp section
10308     {
10309       bar();
10310     }
10311   }
10312 #pragma omp sections
10313   {
10314 #pragma omp critical
10315     bar();
10316 #pragma omp single // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
10317     bar();
10318 #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}}
10319     bar();
10320   }
10321 #pragma omp sections
10322   {
10323 #pragma omp parallel
10324     {
10325 #pragma omp single // OK
10326       {
10327         bar();
10328       }
10329 #pragma omp for // OK
10330       for (int i = 0; i < 10; ++i)
10331         ;
10332 #pragma omp for simd // OK
10333       for (int i = 0; i < 10; ++i)
10334         ;
10335 #pragma omp sections // OK
10336       {
10337         bar();
10338       }
10339     }
10340   }
10341 #pragma omp sections
10342   {
10343 #pragma omp parallel for
10344     for (int i = 0; i < 10; ++i)
10345       ;
10346   }
10347 #pragma omp sections
10348   {
10349 #pragma omp parallel for simd
10350     for (int i = 0; i < 10; ++i)
10351       ;
10352   }
10353 #pragma omp sections
10354   {
10355 #pragma omp parallel sections
10356     {
10357       bar();
10358     }
10359   }
10360 #pragma omp sections
10361   {
10362 #pragma omp task
10363     {
10364       bar();
10365     }
10366   }
10367 #pragma omp sections
10368   {
10369 #pragma omp taskyield
10370   }
10371 #pragma omp sections
10372   {
10373 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}}
10374     bar();
10375   }
10376 #pragma omp sections
10377   {
10378 #pragma omp taskwait
10379   }
10380 #pragma omp sections
10381   {
10382 #pragma omp flush
10383   }
10384 #pragma omp sections
10385   {
10386 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
10387     bar();
10388   }
10389 #pragma omp sections
10390   {
10391 #pragma omp atomic
10392     ++a;
10393   }
10394 #pragma omp sections
10395   {
10396 #pragma omp target
10397     ++a;
10398   }
10399 #pragma omp sections
10400   {
10401 #pragma omp target parallel
10402     ++a;
10403   }
10404 #pragma omp sections
10405   {
10406 #pragma omp target parallel for
10407     for (int i = 0; i < 10; ++i)
10408       ;
10409   }
10410 #pragma omp sections
10411   {
10412 #pragma omp target enter data map(to: a)
10413   }
10414 #pragma omp sections
10415   {
10416 #pragma omp target exit data map(from: a)
10417   }
10418 #pragma omp sections
10419   {
10420 #pragma omp teams // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
10421     ++a;
10422   }
10423 #pragma omp sections
10424   {
10425 #pragma omp taskloop
10426   for (int i = 0; i < 10; ++i)
10427     ++a;
10428   }
10429 #pragma omp sections
10430   {
10431 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
10432     for (int i = 0; i < 10; ++i)
10433       ;
10434   }
10435 #pragma omp sections
10436   {
10437 #pragma omp target update to(a)
10438   }
10439 #pragma omp sections
10440   {
10441 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
10442     for (int i = 0; i < 10; ++i)
10443       ;
10444   }
10445 #pragma omp sections
10446   {
10447 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
10448     for (int i = 0; i < 10; ++i)
10449       ;
10450   }
10451 #pragma omp sections
10452   {
10453 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
10454     for (int i = 0; i < 10; ++i)
10455       ;
10456   }
10457 #pragma omp sections
10458   {
10459 #pragma omp target simd // OK
10460     for (int i = 0; i < 10; ++i)
10461       ;
10462   }
10463 #pragma omp sections
10464   {
10465 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
10466     for (int i = 0; i < 10; ++i)
10467       ;
10468   }
10469 #pragma omp sections
10470   {
10471 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
10472     for (int i = 0; i < 10; ++i)
10473       ;
10474   }
10475 #pragma omp sections
10476   {
10477 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
10478     for (int i = 0; i < 10; ++i)
10479       ;
10480   }
10481 #pragma omp sections
10482   {
10483 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
10484     for (int i = 0; i < 10; ++i)
10485       ;
10486   }
10487 #pragma omp sections
10488   {
10489 #pragma omp target teams // OK
10490     a++;
10491   }
10492 #pragma omp sections
10493   {
10494 #pragma omp target teams distribute // OK
10495     for (int i = 0; i < 10; ++i)
10496       ;
10497   }
10498 #pragma omp sections
10499   {
10500 #pragma omp target teams distribute parallel for // OK
10501     for (int i = 0; i < 10; ++i)
10502       ;
10503   }
10504 #pragma omp sections
10505   {
10506 #pragma omp target teams distribute parallel for simd // OK
10507     for (int i = 0; i < 10; ++i)
10508       ;
10509   }
10510 #pragma omp sections
10511   {
10512 #pragma omp target teams distribute simd // OK
10513     for (int i = 0; i < 10; ++i)
10514       ;
10515   }
10516 
10517 // SECTION DIRECTIVE
10518 #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
10519   {
10520     bar();
10521   }
10522 #pragma omp sections
10523   {
10524 #pragma omp section
10525     {
10526 #pragma omp for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
10527       for (int i = 0; i < 10; ++i)
10528         ;
10529     }
10530   }
10531 #pragma omp sections
10532   {
10533 #pragma omp section
10534     {
10535 #pragma omp simd
10536       for (int i = 0; i < 10; ++i)
10537         ;
10538     }
10539   }
10540 #pragma omp sections
10541   {
10542 #pragma omp section
10543     {
10544 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
10545       for (int i = 0; i < 10; ++i)
10546         ;
10547     }
10548   }
10549 #pragma omp sections
10550   {
10551 #pragma omp section
10552     {
10553 #pragma omp parallel
10554       for (int i = 0; i < 10; ++i)
10555         ;
10556     }
10557   }
10558 #pragma omp sections
10559   {
10560 #pragma omp section
10561     {
10562 #pragma omp sections // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
10563       {
10564         bar();
10565       }
10566     }
10567   }
10568 #pragma omp sections
10569   {
10570 #pragma omp section
10571     {
10572 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a section region}}
10573       {
10574         bar();
10575       }
10576     }
10577   }
10578 #pragma omp sections
10579   {
10580 #pragma omp section
10581     {
10582 #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
10583       bar();
10584 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
10585       bar();
10586 #pragma omp critical
10587       bar();
10588     }
10589   }
10590 #pragma omp sections
10591   {
10592 #pragma omp section
10593     {
10594 #pragma omp parallel
10595       {
10596 #pragma omp single // OK
10597         {
10598           bar();
10599         }
10600 #pragma omp for // OK
10601         for (int i = 0; i < 10; ++i)
10602           ;
10603 #pragma omp for simd // OK
10604         for (int i = 0; i < 10; ++i)
10605           ;
10606 #pragma omp sections // OK
10607         {
10608           bar();
10609         }
10610       }
10611     }
10612   }
10613 #pragma omp sections
10614   {
10615 #pragma omp section
10616     {
10617 #pragma omp parallel for
10618       for (int i = 0; i < 10; ++i)
10619         ;
10620     }
10621   }
10622 #pragma omp sections
10623   {
10624 #pragma omp section
10625     {
10626 #pragma omp parallel for simd
10627       for (int i = 0; i < 10; ++i)
10628         ;
10629     }
10630   }
10631 #pragma omp sections
10632   {
10633 #pragma omp section
10634     {
10635 #pragma omp parallel sections
10636       {
10637         bar();
10638       }
10639     }
10640   }
10641 #pragma omp sections
10642   {
10643 #pragma omp section
10644     {
10645 #pragma omp task
10646       {
10647         bar();
10648       }
10649     }
10650   }
10651 #pragma omp sections
10652   {
10653 #pragma omp section
10654     {
10655 #pragma omp taskyield
10656       bar();
10657     }
10658   }
10659 #pragma omp sections
10660   {
10661 #pragma omp section
10662     {
10663 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'section' region}}
10664       bar();
10665     }
10666   }
10667 #pragma omp sections
10668   {
10669 #pragma omp section
10670     {
10671 #pragma omp taskwait
10672       bar();
10673     }
10674   }
10675 #pragma omp sections
10676   {
10677 #pragma omp section
10678     {
10679 #pragma omp flush
10680       bar();
10681     }
10682   }
10683 #pragma omp sections
10684   {
10685 #pragma omp section
10686     {
10687 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
10688       bar();
10689     }
10690   }
10691 #pragma omp sections
10692   {
10693 #pragma omp section
10694     {
10695 #pragma omp atomic
10696       ++a;
10697     }
10698   }
10699 #pragma omp sections
10700   {
10701 #pragma omp section
10702     {
10703 #pragma omp target
10704       ++a;
10705     }
10706   }
10707 #pragma omp sections
10708   {
10709 #pragma omp section
10710     {
10711 #pragma omp target parallel
10712       ++a;
10713     }
10714   }
10715 #pragma omp sections
10716   {
10717 #pragma omp section
10718     {
10719 #pragma omp target parallel for
10720       for (int i = 0; i < 10; ++i)
10721         ;
10722     }
10723   }
10724 #pragma omp sections
10725   {
10726 #pragma omp section
10727     {
10728 #pragma omp target enter data map(to: a)
10729       ++a;
10730     }
10731   }
10732 #pragma omp sections
10733   {
10734 #pragma omp section
10735     {
10736 #pragma omp target exit data map(from: a)
10737       ++a;
10738     }
10739   }
10740 #pragma omp sections
10741   {
10742 #pragma omp section
10743     {
10744 #pragma omp teams // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
10745       ++a;
10746     }
10747   }
10748 #pragma omp sections
10749   {
10750 #pragma omp section
10751     {
10752 #pragma omp taskloop
10753   for (int i = 0; i < 10; ++i)
10754       ++a;
10755     }
10756   }
10757 #pragma omp sections
10758   {
10759 #pragma omp section
10760 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
10761     for (int i = 0; i < 10; ++i)
10762       ;
10763   }
10764 #pragma omp sections
10765   {
10766 #pragma omp section
10767     {
10768 #pragma omp target update to(a)
10769       a++;
10770     }
10771   }
10772 #pragma omp sections
10773   {
10774 #pragma omp section
10775 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
10776     for (int i = 0; i < 10; ++i)
10777       ;
10778   }
10779 #pragma omp sections
10780   {
10781 #pragma omp section
10782 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
10783     for (int i = 0; i < 10; ++i)
10784       ;
10785   }
10786 #pragma omp sections
10787   {
10788 #pragma omp section
10789 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
10790     for (int i = 0; i < 10; ++i)
10791       ;
10792   }
10793 #pragma omp sections
10794   {
10795 #pragma omp section
10796 #pragma omp target simd // OK
10797     for (int i = 0; i < 10; ++i)
10798       ;
10799   }
10800 #pragma omp sections
10801   {
10802 #pragma omp section
10803 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
10804     for (int i = 0; i < 10; ++i)
10805       ;
10806   }
10807 #pragma omp sections
10808   {
10809 #pragma omp section
10810 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
10811     for (int i = 0; i < 10; ++i)
10812       ;
10813   }
10814 #pragma omp sections
10815   {
10816 #pragma omp section
10817 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
10818     for (int i = 0; i < 10; ++i)
10819       ;
10820   }
10821 #pragma omp sections
10822   {
10823 #pragma omp section
10824 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
10825     for (int i = 0; i < 10; ++i)
10826       ;
10827   }
10828 #pragma omp sections
10829   {
10830 #pragma omp section
10831 #pragma omp target teams // OK
10832     a++;
10833   }
10834 #pragma omp sections
10835   {
10836 #pragma omp section
10837 #pragma omp target teams distribute // OK
10838     for (int i = 0; i < 10; ++i)
10839       ;
10840   }
10841 #pragma omp sections
10842   {
10843 #pragma omp section
10844 #pragma omp target teams distribute parallel for // OK
10845     for (int i = 0; i < 10; ++i)
10846       ;
10847   }
10848 #pragma omp sections
10849   {
10850 #pragma omp section
10851 #pragma omp target teams distribute parallel for simd // OK
10852     for (int i = 0; i < 10; ++i)
10853       ;
10854   }
10855 #pragma omp sections
10856   {
10857 #pragma omp section
10858 #pragma omp target teams distribute simd // OK
10859     for (int i = 0; i < 10; ++i)
10860       ;
10861   }
10862 
10863 // SINGLE DIRECTIVE
10864 #pragma omp single
10865   {
10866 #pragma omp for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
10867     for (int i = 0; i < 10; ++i)
10868       ;
10869   }
10870 #pragma omp single
10871   {
10872 #pragma omp simd
10873     for (int i = 0; i < 10; ++i)
10874       ;
10875   }
10876 #pragma omp single
10877   {
10878 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
10879     for (int i = 0; i < 10; ++i)
10880       ;
10881   }
10882 #pragma omp single
10883   {
10884 #pragma omp parallel
10885     for (int i = 0; i < 10; ++i)
10886       ;
10887   }
10888 #pragma omp single
10889   {
10890 #pragma omp single // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
10891     {
10892       bar();
10893     }
10894 #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}}
10895     bar();
10896 #pragma omp critical
10897     bar();
10898   }
10899 #pragma omp single
10900   {
10901 #pragma omp sections // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
10902     {
10903       bar();
10904     }
10905   }
10906 #pragma omp single
10907   {
10908 #pragma omp parallel
10909     {
10910 #pragma omp single // OK
10911       {
10912         bar();
10913       }
10914 #pragma omp for // OK
10915       for (int i = 0; i < 10; ++i)
10916         ;
10917 #pragma omp for simd // OK
10918       for (int i = 0; i < 10; ++i)
10919         ;
10920 #pragma omp sections // OK
10921       {
10922         bar();
10923       }
10924     }
10925   }
10926 #pragma omp single
10927   {
10928 #pragma omp parallel for
10929     for (int i = 0; i < 10; ++i)
10930       ;
10931   }
10932 #pragma omp single
10933   {
10934 #pragma omp parallel for simd
10935     for (int i = 0; i < 10; ++i)
10936       ;
10937   }
10938 #pragma omp single
10939   {
10940 #pragma omp parallel sections
10941     {
10942       bar();
10943     }
10944   }
10945 #pragma omp single
10946   {
10947 #pragma omp task
10948     {
10949       bar();
10950     }
10951   }
10952 #pragma omp single
10953   {
10954 #pragma omp taskyield
10955     bar();
10956   }
10957 #pragma omp single
10958   {
10959 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}}
10960     bar();
10961   }
10962 #pragma omp single
10963   {
10964 #pragma omp taskwait
10965     bar();
10966   }
10967 #pragma omp single
10968   {
10969 #pragma omp flush
10970     bar();
10971   }
10972 #pragma omp single
10973   {
10974 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
10975     bar();
10976   }
10977 #pragma omp single
10978   {
10979 #pragma omp atomic
10980     ++a;
10981   }
10982 #pragma omp single
10983   {
10984 #pragma omp target
10985     ++a;
10986   }
10987 #pragma omp single
10988   {
10989 #pragma omp target parallel
10990     ++a;
10991   }
10992 #pragma omp single
10993   {
10994 #pragma omp target parallel for
10995     for (int i = 0; i < 10; ++i)
10996       ;
10997   }
10998 #pragma omp single
10999   {
11000 #pragma omp target enter data map(to: a)
11001     ++a;
11002   }
11003 #pragma omp single
11004   {
11005 #pragma omp target exit data map(from: a)
11006     ++a;
11007   }
11008 #pragma omp single
11009   {
11010 #pragma omp teams // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
11011     ++a;
11012   }
11013 #pragma omp single
11014   {
11015 #pragma omp taskloop
11016   for (int i = 0; i < 10; ++i)
11017     ++a;
11018   }
11019 #pragma omp single
11020   {
11021 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
11022     for (int i = 0; i < 10; ++i)
11023       ;
11024   }
11025 #pragma omp single
11026   {
11027 #pragma omp target update to(a)
11028     a++;
11029   }
11030 #pragma omp single
11031   {
11032 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
11033     for (int i = 0; i < 10; ++i)
11034       ;
11035   }
11036 #pragma omp single
11037   {
11038 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
11039     for (int i = 0; i < 10; ++i)
11040       ;
11041   }
11042 #pragma omp single
11043   {
11044 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
11045     for (int i = 0; i < 10; ++i)
11046       ;
11047   }
11048 #pragma omp single
11049   {
11050 #pragma omp target simd // OK
11051     for (int i = 0; i < 10; ++i)
11052       ;
11053   }
11054 #pragma omp single
11055   {
11056 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
11057     for (int i = 0; i < 10; ++i)
11058       ;
11059   }
11060 #pragma omp single
11061   {
11062 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
11063     for (int i = 0; i < 10; ++i)
11064       ;
11065   }
11066 #pragma omp single
11067   {
11068 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
11069     for (int i = 0; i < 10; ++i)
11070       ;
11071   }
11072 #pragma omp single
11073   {
11074 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
11075     for (int i = 0; i < 10; ++i)
11076       ;
11077   }
11078 #pragma omp single
11079   {
11080 #pragma omp target teams // oK
11081     a++;
11082   }
11083 #pragma omp single
11084   {
11085 #pragma omp target teams distribute // OK
11086     for (int i = 0; i < 10; ++i)
11087       ;
11088   }
11089 #pragma omp single
11090   {
11091 #pragma omp target teams distribute parallel for // OK
11092     for (int i = 0; i < 10; ++i)
11093       ;
11094   }
11095 #pragma omp single
11096   {
11097 #pragma omp target teams distribute parallel for simd // OK
11098     for (int i = 0; i < 10; ++i)
11099       ;
11100   }
11101 #pragma omp single
11102   {
11103 #pragma omp target teams distribute simd // OK
11104     for (int i = 0; i < 10; ++i)
11105       ;
11106   }
11107 
11108 // MASTER DIRECTIVE
11109 #pragma omp master
11110   {
11111 #pragma omp for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
11112     for (int i = 0; i < 10; ++i)
11113       ;
11114   }
11115 #pragma omp master
11116   {
11117 #pragma omp simd
11118     for (int i = 0; i < 10; ++i)
11119       ;
11120   }
11121 #pragma omp master
11122   {
11123 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
11124     for (int i = 0; i < 10; ++i)
11125       ;
11126   }
11127 #pragma omp master
11128   {
11129 #pragma omp parallel
11130     for (int i = 0; i < 10; ++i)
11131       ;
11132   }
11133 #pragma omp parallel master
11134   {
11135     for (int i = 0; i < 10; ++i)
11136       ;
11137   }
11138 #pragma omp master
11139   {
11140 #pragma omp single // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
11141     {
11142       bar();
11143     }
11144   }
11145 #pragma omp master
11146   {
11147 #pragma omp master // OK, though second 'master' is redundant
11148     {
11149       bar();
11150     }
11151   }
11152 #pragma omp master
11153   {
11154 #pragma omp critical
11155     {
11156       bar();
11157     }
11158   }
11159 #pragma omp master
11160   {
11161 #pragma omp sections // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
11162     {
11163       bar();
11164     }
11165   }
11166 #pragma omp master
11167   {
11168 #pragma omp parallel
11169     {
11170 #pragma omp master // OK
11171       {
11172         bar();
11173       }
11174 #pragma omp for // OK
11175       for (int i = 0; i < 10; ++i)
11176         ;
11177 #pragma omp for simd // OK
11178       for (int i = 0; i < 10; ++i)
11179         ;
11180 #pragma omp sections // OK
11181       {
11182         bar();
11183       }
11184     }
11185   }
11186 #pragma omp master
11187   {
11188 #pragma omp parallel master
11189     {
11190       bar();
11191     }
11192   }
11193 #pragma omp master
11194   {
11195 #pragma omp parallel for
11196     for (int i = 0; i < 10; ++i)
11197       ;
11198   }
11199 #pragma omp master
11200   {
11201 #pragma omp parallel for simd
11202     for (int i = 0; i < 10; ++i)
11203       ;
11204   }
11205 #pragma omp master
11206   {
11207 #pragma omp parallel sections
11208     {
11209       bar();
11210     }
11211   }
11212 #pragma omp master
11213   {
11214 #pragma omp task
11215     {
11216       bar();
11217     }
11218   }
11219 #pragma omp master
11220   {
11221 #pragma omp taskyield
11222     bar();
11223   }
11224 #pragma omp master
11225   {
11226 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}}
11227     bar();
11228   }
11229 #pragma omp master
11230   {
11231 #pragma omp taskwait
11232     bar();
11233   }
11234 #pragma omp master
11235   {
11236 #pragma omp flush
11237     bar();
11238   }
11239 #pragma omp master
11240   {
11241 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
11242     bar();
11243   }
11244 #pragma omp master
11245   {
11246 #pragma omp atomic
11247     ++a;
11248   }
11249 #pragma omp master
11250   {
11251 #pragma omp target
11252     ++a;
11253   }
11254 #pragma omp master
11255   {
11256 #pragma omp target parallel
11257     ++a;
11258   }
11259 #pragma omp master
11260   {
11261 #pragma omp target parallel for
11262     for (int i = 0; i < 10; ++i)
11263       ;
11264   }
11265 #pragma omp master
11266   {
11267 #pragma omp target enter data map(to: a)
11268     ++a;
11269   }
11270 #pragma omp master
11271   {
11272 #pragma omp target exit data map(from: a)
11273     ++a;
11274   }
11275 #pragma omp master
11276   {
11277 #pragma omp teams // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
11278     ++a;
11279   }
11280 #pragma omp master
11281   {
11282 #pragma omp taskloop
11283   for (int i = 0; i < 10; ++i)
11284     ++a;
11285   }
11286 #pragma omp master
11287   {
11288 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
11289     for (int i = 0; i < 10; ++i)
11290       ;
11291   }
11292 #pragma omp master
11293   {
11294 #pragma omp target update to(a)
11295     ++a;
11296   }
11297 #pragma omp master
11298   {
11299 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
11300     for (int i = 0; i < 10; ++i)
11301       ;
11302   }
11303 #pragma omp master
11304   {
11305 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
11306     for (int i = 0; i < 10; ++i)
11307       ;
11308   }
11309 #pragma omp master
11310   {
11311 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
11312     for (int i = 0; i < 10; ++i)
11313       ;
11314   }
11315 #pragma omp master
11316   {
11317 #pragma omp target simd // OK
11318     for (int i = 0; i < 10; ++i)
11319       ;
11320   }
11321 #pragma omp master
11322   {
11323 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
11324     for (int i = 0; i < 10; ++i)
11325       ;
11326   }
11327 #pragma omp master
11328   {
11329 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
11330     for (int i = 0; i < 10; ++i)
11331       ;
11332   }
11333 #pragma omp master
11334   {
11335 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
11336     for (int i = 0; i < 10; ++i)
11337       ;
11338   }
11339 #pragma omp master
11340   {
11341 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
11342     for (int i = 0; i < 10; ++i)
11343       ;
11344   }
11345 #pragma omp master
11346   {
11347 #pragma omp target teams // OK
11348     a++;
11349   }
11350 #pragma omp master
11351   {
11352 #pragma omp target teams distribute // OK
11353     for (int i = 0; i < 10; ++i)
11354       ;
11355   }
11356 #pragma omp master
11357   {
11358 #pragma omp target teams distribute parallel for // OK
11359     for (int i = 0; i < 10; ++i)
11360       ;
11361   }
11362 #pragma omp master
11363   {
11364 #pragma omp target teams distribute parallel for simd // OK
11365     for (int i = 0; i < 10; ++i)
11366       ;
11367   }
11368 #pragma omp master
11369   {
11370 #pragma omp target teams distribute simd // OK
11371     for (int i = 0; i < 10; ++i)
11372       ;
11373   }
11374 
11375 // CRITICAL DIRECTIVE
11376 #pragma omp critical
11377   {
11378 #pragma omp for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
11379     for (int i = 0; i < 10; ++i)
11380       ;
11381   }
11382 #pragma omp critical
11383   {
11384 #pragma omp simd
11385     for (int i = 0; i < 10; ++i)
11386       ;
11387   }
11388 #pragma omp critical
11389   {
11390 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
11391     for (int i = 0; i < 10; ++i)
11392       ;
11393   }
11394 #pragma omp critical
11395   {
11396 #pragma omp parallel
11397     for (int i = 0; i < 10; ++i)
11398       ;
11399   }
11400 #pragma omp critical
11401   {
11402 #pragma omp single // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
11403     {
11404       bar();
11405     }
11406   }
11407 #pragma omp critical
11408   {
11409 #pragma omp master // OK, though second 'master' is redundant
11410     {
11411       bar();
11412     }
11413   }
11414 #pragma omp critical
11415   {
11416 #pragma omp critical
11417     {
11418       bar();
11419     }
11420   }
11421 #pragma omp critical
11422   {
11423 #pragma omp sections // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
11424     {
11425       bar();
11426     }
11427   }
11428 #pragma omp critical
11429   {
11430 #pragma omp parallel
11431     {
11432 #pragma omp master // OK
11433       {
11434         bar();
11435       }
11436 #pragma omp for // OK
11437       for (int i = 0; i < 10; ++i)
11438         ;
11439 #pragma omp for simd // OK
11440       for (int i = 0; i < 10; ++i)
11441         ;
11442 #pragma omp sections // OK
11443       {
11444         bar();
11445       }
11446     }
11447   }
11448 #pragma omp critical
11449   {
11450 #pragma omp parallel for
11451     for (int i = 0; i < 10; ++i)
11452       ;
11453   }
11454 #pragma omp critical
11455   {
11456 #pragma omp parallel for simd
11457     for (int i = 0; i < 10; ++i)
11458       ;
11459   }
11460 #pragma omp critical
11461   {
11462 #pragma omp parallel sections
11463     {
11464       bar();
11465     }
11466   }
11467 #pragma omp critical
11468   {
11469 #pragma omp task
11470     {
11471       bar();
11472     }
11473   }
11474 #pragma omp critical
11475   {
11476 #pragma omp taskyield
11477     bar();
11478   }
11479 #pragma omp critical
11480   {
11481 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'critical' region}}
11482     bar();
11483   }
11484 #pragma omp critical
11485   {
11486 #pragma omp taskwait
11487     bar();
11488   }
11489 #pragma omp critical(Belka)
11490   {
11491 #pragma omp critical(Strelka)
11492     bar();
11493   }
11494 #pragma omp critical(Tuzik) // expected-note {{previous 'critical' region starts here}}
11495   {
11496 #pragma omp critical(grelka) // expected-note {{previous 'critical' region starts here}}
11497     {
11498 #pragma omp critical(Tuzik) // expected-error {{cannot nest 'critical' regions having the same name 'Tuzik'}}
11499       {
11500 #pragma omp parallel
11501 #pragma omp critical(grelka) // expected-error {{cannot nest 'critical' regions having the same name 'grelka'}}
11502         {
11503           bar();
11504         }
11505       }
11506     }
11507   }
11508 #pragma omp critical
11509   {
11510 #pragma omp flush
11511     bar();
11512   }
11513 #pragma omp critical
11514   {
11515 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
11516     bar();
11517   }
11518 #pragma omp critical
11519   {
11520 #pragma omp atomic
11521     ++a;
11522   }
11523 #pragma omp critical
11524   {
11525 #pragma omp target
11526     ++a;
11527   }
11528 #pragma omp critical
11529   {
11530 #pragma omp target parallel
11531     ++a;
11532   }
11533 #pragma omp critical
11534   {
11535 #pragma omp target parallel for
11536     for (int i = 0; i < 10; ++i)
11537       ;
11538   }
11539 #pragma omp critical
11540   {
11541 #pragma omp target enter data map(to: a)
11542     ++a;
11543   }
11544 #pragma omp critical
11545   {
11546 #pragma omp target exit data map(from: a)
11547     ++a;
11548   }
11549 #pragma omp critical
11550   {
11551 #pragma omp teams // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
11552     ++a;
11553   }
11554 #pragma omp critical
11555   {
11556 #pragma omp taskloop
11557   for (int i = 0; i < 10; ++i)
11558     ++a;
11559   }
11560 #pragma omp critical
11561   {
11562 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
11563     for (int i = 0; i < 10; ++i)
11564       ;
11565   }
11566 #pragma omp critical
11567   {
11568 #pragma omp target update to(a)
11569     a++;
11570   }
11571 #pragma omp critical
11572   {
11573 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
11574     for (int i = 0; i < 10; ++i)
11575       ;
11576   }
11577 #pragma omp critical
11578   {
11579 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
11580     for (int i = 0; i < 10; ++i)
11581       ;
11582   }
11583 #pragma omp critical
11584   {
11585 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
11586     for (int i = 0; i < 10; ++i)
11587       ;
11588   }
11589 #pragma omp critical
11590   {
11591 #pragma omp target simd // OK
11592     for (int i = 0; i < 10; ++i)
11593       ;
11594   }
11595 #pragma omp critical
11596   {
11597 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
11598     for (int i = 0; i < 10; ++i)
11599       ;
11600   }
11601 #pragma omp critical
11602   {
11603 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
11604     for (int i = 0; i < 10; ++i)
11605       ;
11606   }
11607 #pragma omp critical
11608   {
11609 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
11610     for (int i = 0; i < 10; ++i)
11611       ;
11612   }
11613 #pragma omp critical
11614   {
11615 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
11616     for (int i = 0; i < 10; ++i)
11617       ;
11618   }
11619 #pragma omp critical
11620   {
11621 #pragma omp target teams // OK
11622     a++;
11623   }
11624 #pragma omp critical
11625   {
11626 #pragma omp target teams distribute // OK
11627     for (int i = 0; i < 10; ++i)
11628       ;
11629   }
11630 #pragma omp critical
11631   {
11632 #pragma omp target teams distribute parallel for // OK
11633     for (int i = 0; i < 10; ++i)
11634       ;
11635   }
11636 #pragma omp critical
11637   {
11638 #pragma omp target teams distribute parallel for simd // OK
11639     for (int i = 0; i < 10; ++i)
11640       ;
11641   }
11642 #pragma omp critical
11643   {
11644 #pragma omp target teams distribute simd // OK
11645     for (int i = 0; i < 10; ++i)
11646       ;
11647   }
11648 
11649 // PARALLEL FOR DIRECTIVE
11650 #pragma omp parallel for
11651   for (int i = 0; i < 10; ++i) {
11652 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
11653     for (int i = 0; i < 10; ++i)
11654       ;
11655   }
11656 #pragma omp parallel for
11657   for (int i = 0; i < 10; ++i) {
11658 #pragma omp simd
11659     for (int i = 0; i < 10; ++i)
11660       ;
11661   }
11662 #pragma omp parallel for
11663   for (int i = 0; i < 10; ++i) {
11664 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
11665     for (int i = 0; i < 10; ++i)
11666       ;
11667   }
11668 
11669 #pragma omp parallel for
11670   for (int i = 0; i < 10; ++i) {
11671 #pragma omp parallel
11672     for (int i = 0; i < 10; ++i)
11673       ;
11674   }
11675 #pragma omp parallel for
11676   for (int i = 0; i < 10; ++i) {
11677 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
11678     {
11679       bar();
11680     }
11681   }
11682 #pragma omp parallel for
11683   for (int i = 0; i < 10; ++i) {
11684 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel for region}}
11685     {
11686       bar();
11687     }
11688   }
11689 #pragma omp parallel for
11690   for (int i = 0; i < 10; ++i) {
11691 #pragma omp single // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
11692     {
11693       bar();
11694     }
11695 #pragma omp master // expected-error {{region cannot be closely nested inside 'parallel for' region}}
11696     {
11697       bar();
11698     }
11699 #pragma omp critical
11700     {
11701       bar();
11702     }
11703   }
11704 #pragma omp parallel for
11705   for (int i = 0; i < 10; ++i) {
11706 #pragma omp parallel
11707     {
11708 #pragma omp single // OK
11709       {
11710         bar();
11711       }
11712 #pragma omp master // OK
11713       {
11714         bar();
11715       }
11716 #pragma omp critical // OK
11717       {
11718         bar();
11719       }
11720 #pragma omp for // OK
11721       for (int i = 0; i < 10; ++i)
11722         ;
11723 #pragma omp for simd // OK
11724       for (int i = 0; i < 10; ++i)
11725         ;
11726 #pragma omp sections // OK
11727       {
11728         bar();
11729       }
11730     }
11731   }
11732 #pragma omp parallel for
11733   for (int i = 0; i < 10; ++i) {
11734 #pragma omp parallel for
11735     for (int i = 0; i < 10; ++i)
11736       ;
11737   }
11738 #pragma omp parallel for
11739   for (int i = 0; i < 10; ++i) {
11740 #pragma omp parallel for simd
11741     for (int i = 0; i < 10; ++i)
11742       ;
11743   }
11744 #pragma omp parallel for
11745   for (int i = 0; i < 10; ++i) {
11746 #pragma omp parallel sections
11747     {
11748       bar();
11749     }
11750   }
11751 #pragma omp parallel for
11752   for (int i = 0; i < 10; ++i) {
11753 #pragma omp task
11754     {
11755       bar();
11756     }
11757   }
11758 #pragma omp parallel for
11759   for (int i = 0; i < 10; ++i) {
11760 #pragma omp taskyield
11761     bar();
11762   }
11763 #pragma omp parallel for
11764   for (int i = 0; i < 10; ++i) {
11765 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}}
11766     bar();
11767   }
11768 #pragma omp parallel for
11769   for (int i = 0; i < 10; ++i) {
11770 #pragma omp taskwait
11771     bar();
11772   }
11773 #pragma omp parallel for
11774   for (int i = 0; i < 10; ++i) {
11775 #pragma omp flush
11776     bar();
11777   }
11778 #pragma omp parallel for
11779   for (int i = 0; i < 10; ++i) {
11780 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
11781     bar();
11782   }
11783 #pragma omp parallel for ordered
11784   for (int i = 0; i < 10; ++i) {
11785 #pragma omp ordered // OK
11786     bar();
11787   }
11788 #pragma omp parallel for
11789   for (int i = 0; i < 10; ++i) {
11790 #pragma omp atomic
11791     ++a;
11792   }
11793 #pragma omp parallel for
11794   for (int i = 0; i < 10; ++i) {
11795 #pragma omp target
11796     ++a;
11797   }
11798 #pragma omp parallel for
11799   for (int i = 0; i < 10; ++i) {
11800 #pragma omp target parallel
11801     ++a;
11802   }
11803 #pragma omp parallel for
11804   for (int i = 0; i < 10; ++i) {
11805 #pragma omp target parallel for
11806     for (int i = 0; i < 10; ++i)
11807       ;
11808   }
11809 #pragma omp parallel for
11810   for (int i = 0; i < 10; ++i) {
11811 #pragma omp target enter data map(to: a)
11812     ++a;
11813   }
11814 #pragma omp parallel for
11815   for (int i = 0; i < 10; ++i) {
11816 #pragma omp target exit data map(from: a)
11817     ++a;
11818   }
11819 #pragma omp parallel for
11820   for (int i = 0; i < 10; ++i) {
11821 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
11822     ++a;
11823   }
11824 #pragma omp parallel for
11825   for (int i = 0; i < 10; ++i) {
11826 #pragma omp taskloop
11827   for (int i = 0; i < 10; ++i)
11828     ++a;
11829   }
11830 #pragma omp parallel for
11831   for (int i = 0; i < 10; ++i) {
11832 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
11833     for (int j = 0; j < 10; ++j)
11834       ;
11835   }
11836 #pragma omp parallel for
11837   for (int i = 0; i < 10; ++i) {
11838 #pragma omp target update to(a)
11839     a++;
11840   }
11841 #pragma omp parallel for
11842   for (int i = 0; i < 10; ++i) {
11843 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
11844     for (int j = 0; j < 10; ++j)
11845       ;
11846   }
11847 #pragma omp parallel for
11848   for (int i = 0; i < 10; ++i) {
11849 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
11850     for (int j = 0; j < 10; ++j)
11851       ;
11852   }
11853 #pragma omp parallel for
11854   for (int i = 0; i < 10; ++i) {
11855 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
11856     for (int j = 0; j < 10; ++j)
11857       ;
11858   }
11859 #pragma omp parallel for
11860   for (int i = 0; i < 10; ++i) {
11861 #pragma omp target simd // OK
11862     for (int j = 0; j < 10; ++j)
11863       ;
11864   }
11865 #pragma omp parallel for
11866   for (int i = 0; i < 10; ++i) {
11867 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
11868     for (int j = 0; j < 10; ++j)
11869       ;
11870   }
11871 #pragma omp parallel for
11872   for (int i = 0; i < 10; ++i) {
11873 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
11874     for (int j = 0; j < 10; ++j)
11875       ;
11876   }
11877 #pragma omp parallel for
11878   for (int i = 0; i < 10; ++i) {
11879 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
11880     for (int j = 0; j < 10; ++j)
11881       ;
11882   }
11883 #pragma omp parallel for
11884   for (int i = 0; i < 10; ++i) {
11885 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
11886     for (int j = 0; j < 10; ++j)
11887       ;
11888   }
11889 #pragma omp parallel for
11890   for (int i = 0; i < 10; ++i) {
11891 #pragma omp target teams // OK
11892     a++;
11893   }
11894 #pragma omp parallel for
11895   for (int i = 0; i < 10; ++i) {
11896 #pragma omp target teams distribute // OK
11897     for (int j = 0; j < 10; ++j)
11898       ;
11899   }
11900 #pragma omp parallel for
11901   for (int i = 0; i < 10; ++i) {
11902 #pragma omp target teams distribute parallel for // OK
11903     for (int j = 0; j < 10; ++j)
11904       ;
11905   }
11906 #pragma omp parallel for
11907   for (int i = 0; i < 10; ++i) {
11908 #pragma omp target teams distribute parallel for simd // OK
11909     for (int j = 0; j < 10; ++j)
11910       ;
11911   }
11912 #pragma omp parallel for
11913   for (int i = 0; i < 10; ++i) {
11914 #pragma omp target teams distribute simd // OK
11915     for (int j = 0; j < 10; ++j)
11916       ;
11917   }
11918 
11919 // PARALLEL FOR SIMD DIRECTIVE
11920 #pragma omp parallel for simd
11921   for (int i = 0; i < 10; ++i) {
11922 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11923     for (int i = 0; i < 10; ++i)
11924       ;
11925   }
11926 #pragma omp parallel for simd
11927   for (int i = 0; i < 10; ++i) {
11928 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
11929     for (int i = 0; i < 10; ++i)
11930       ;
11931   }
11932 #pragma omp parallel for simd
11933   for (int i = 0; i < 10; ++i) {
11934 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11935     for (int i = 0; i < 10; ++i)
11936       ;
11937   }
11938 #pragma omp parallel for simd
11939   for (int i = 0; i < 10; ++i) {
11940 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11941     for (int i = 0; i < 10; ++i)
11942       ;
11943   }
11944 #pragma omp parallel for simd
11945   for (int i = 0; i < 10; ++i) {
11946 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11947     {
11948       bar();
11949     }
11950   }
11951 #pragma omp parallel for simd
11952   for (int i = 0; i < 10; ++i) {
11953 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11954     {
11955       bar();
11956     }
11957   }
11958 #pragma omp parallel for simd
11959   for (int i = 0; i < 10; ++i) {
11960 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11961     {
11962       bar();
11963     }
11964   }
11965 
11966 #pragma omp parallel for simd
11967   for (int i = 0; i < 10; ++i) {
11968 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11969     {
11970       bar();
11971     }
11972   }
11973 
11974 #pragma omp parallel for simd
11975   for (int i = 0; i < 10; ++i) {
11976 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11977     {
11978       bar();
11979     }
11980   }
11981 
11982 #pragma omp parallel for simd
11983   for (int i = 0; i < 10; ++i) {
11984 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11985     {
11986 #pragma omp single
11987       {
11988         bar();
11989       }
11990 #pragma omp for
11991       for (int i = 0; i < 10; ++i)
11992         ;
11993 #pragma omp for simd
11994       for (int i = 0; i < 10; ++i)
11995         ;
11996 #pragma omp sections
11997       {
11998         bar();
11999       }
12000     }
12001   }
12002 #pragma omp parallel for simd
12003   for (int i = 0; i < 10; ++i) {
12004 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12005     for (int i = 0; i < 10; ++i)
12006       ;
12007   }
12008 #pragma omp parallel for simd
12009   for (int i = 0; i < 10; ++i) {
12010 #pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
12011     for (int i = 0; i < 10; ++i)
12012       ;
12013   }
12014 #pragma omp parallel for simd
12015   for (int i = 0; i < 10; ++i) {
12016 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12017     {
12018       bar();
12019     }
12020   }
12021 #pragma omp parallel for simd
12022   for (int i = 0; i < 10; ++i) {
12023 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12024     {
12025       bar();
12026     }
12027   }
12028 #pragma omp parallel for simd
12029   for (int i = 0; i < 10; ++i) {
12030 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12031     bar();
12032   }
12033 #pragma omp parallel for simd
12034   for (int i = 0; i < 10; ++i) {
12035 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12036     bar();
12037   }
12038 #pragma omp parallel for simd
12039   for (int i = 0; i < 10; ++i) {
12040 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12041     bar();
12042   }
12043 #pragma omp parallel for simd
12044   for (int i = 0; i < 10; ++i) {
12045 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12046     bar();
12047   }
12048 #pragma omp parallel for simd
12049   for (int i = 0; i < 10; ++i) {
12050 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12051     bar();
12052   }
12053 #pragma omp parallel for simd
12054   for (int i = 0; i < 10; ++i) {
12055 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12056     bar();
12057   }
12058 #pragma omp parallel for simd
12059   for (int i = 0; i < 10; ++i) {
12060 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
12061     ++a;
12062   }
12063 #pragma omp parallel for simd
12064   for (int i = 0; i < 10; ++i) {
12065 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12066     ++a;
12067   }
12068 #pragma omp parallel for simd
12069   for (int i = 0; i < 10; ++i) {
12070 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12071     ++a;
12072   }
12073 #pragma omp parallel for simd
12074   for (int i = 0; i < 10; ++i) {
12075 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12076     for (int i = 0; i < 10; ++i)
12077       ;
12078   }
12079 #pragma omp parallel for simd
12080   for (int i = 0; i < 10; ++i) {
12081 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12082     ++a;
12083   }
12084 #pragma omp parallel for simd
12085   for (int i = 0; i < 10; ++i) {
12086 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12087     ++a;
12088   }
12089 #pragma omp parallel for simd
12090   for (int i = 0; i < 10; ++i) {
12091 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12092     ++a;
12093   }
12094 #pragma omp parallel for simd
12095   for (int i = 0; i < 10; ++i) {
12096 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12097   for (int i = 0; i < 10; ++i)
12098     ++a;
12099   }
12100 #pragma omp parallel for simd
12101   for (int i = 0; i < 10; ++i) {
12102 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12103     for (int j = 0; j < 10; ++j)
12104       ;
12105   }
12106 #pragma omp parallel for simd
12107   for (int i = 0; i < 10; ++i) {
12108 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12109     a++;
12110   }
12111 #pragma omp parallel for simd
12112   for (int i = 0; i < 10; ++i) {
12113 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12114     for (int j = 0; j < 10; ++j)
12115       ;
12116   }
12117 #pragma omp parallel for simd
12118   for (int i = 0; i < 10; ++i) {
12119 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12120     for (int j = 0; j < 10; ++j)
12121       ;
12122   }
12123 #pragma omp parallel for simd
12124   for (int i = 0; i < 10; ++i) {
12125 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12126     for (int j = 0; j < 10; ++j)
12127       ;
12128   }
12129 #pragma omp parallel for simd
12130   for (int i = 0; i < 10; ++i) {
12131 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12132     for (int j = 0; j < 10; ++j)
12133       ;
12134   }
12135 #pragma omp parallel for simd
12136   for (int i = 0; i < 10; ++i) {
12137 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12138     for (int j = 0; j < 10; ++j)
12139       ;
12140   }
12141 #pragma omp parallel for simd
12142   for (int i = 0; i < 10; ++i) {
12143 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12144     for (int j = 0; j < 10; ++j)
12145       ;
12146   }
12147 #pragma omp parallel for simd
12148   for (int i = 0; i < 10; ++i) {
12149 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12150     for (int j = 0; j < 10; ++j)
12151       ;
12152   }
12153 #pragma omp parallel for simd
12154   for (int i = 0; i < 10; ++i) {
12155 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12156     for (int j = 0; j < 10; ++j)
12157       ;
12158   }
12159 #pragma omp parallel for simd
12160   for (int i = 0; i < 10; ++i) {
12161 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12162     a++;
12163   }
12164 #pragma omp parallel for simd
12165   for (int i = 0; i < 10; ++i) {
12166 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12167     for (int j = 0; j < 10; ++j)
12168       ;
12169   }
12170 #pragma omp parallel for simd
12171   for (int i = 0; i < 10; ++i) {
12172 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12173     for (int j = 0; j < 10; ++j)
12174       ;
12175   }
12176 #pragma omp parallel for simd
12177   for (int i = 0; i < 10; ++i) {
12178 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12179     for (int j = 0; j < 10; ++j)
12180       ;
12181   }
12182 #pragma omp parallel for simd
12183   for (int i = 0; i < 10; ++i) {
12184 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
12185     for (int j = 0; j < 10; ++j)
12186       ;
12187   }
12188 
12189 // PARALLEL SECTIONS DIRECTIVE
12190 #pragma omp parallel sections
12191   {
12192 #pragma omp for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
12193     for (int i = 0; i < 10; ++i)
12194       ;
12195   }
12196 #pragma omp parallel sections
12197   {
12198 #pragma omp simd
12199     for (int i = 0; i < 10; ++i)
12200       ;
12201   }
12202 #pragma omp parallel sections
12203   {
12204 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
12205     for (int i = 0; i < 10; ++i)
12206       ;
12207   }
12208 #pragma omp parallel sections
12209   {
12210 #pragma omp parallel
12211     for (int i = 0; i < 10; ++i)
12212       ;
12213   }
12214 #pragma omp parallel sections
12215   {
12216 #pragma omp sections // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
12217     {
12218       bar();
12219     }
12220   }
12221 #pragma omp parallel sections
12222   {
12223 #pragma omp section
12224     {
12225       bar();
12226     }
12227   }
12228 #pragma omp parallel sections
12229   {
12230 #pragma omp section
12231     {
12232 #pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
12233       bar();
12234 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
12235       bar();
12236 #pragma omp critical
12237       bar();
12238     }
12239   }
12240 #pragma omp parallel sections
12241   {
12242 #pragma omp parallel
12243     {
12244 #pragma omp single // OK
12245       {
12246         bar();
12247       }
12248 #pragma omp master // OK
12249       {
12250         bar();
12251       }
12252 #pragma omp critical // OK
12253       {
12254         bar();
12255       }
12256 #pragma omp for // OK
12257       for (int i = 0; i < 10; ++i)
12258         ;
12259 #pragma omp for simd // OK
12260       for (int i = 0; i < 10; ++i)
12261         ;
12262 #pragma omp sections // OK
12263       {
12264         bar();
12265       }
12266     }
12267   }
12268 #pragma omp parallel sections
12269   {
12270 #pragma omp parallel for
12271     for (int i = 0; i < 10; ++i)
12272       ;
12273   }
12274 #pragma omp parallel sections
12275   {
12276 #pragma omp parallel for simd
12277     for (int i = 0; i < 10; ++i)
12278       ;
12279   }
12280 #pragma omp parallel sections
12281   {
12282 #pragma omp parallel sections
12283     {
12284       bar();
12285     }
12286   }
12287 #pragma omp parallel sections
12288   {
12289 #pragma omp task
12290     {
12291       bar();
12292     }
12293   }
12294 #pragma omp parallel sections
12295   {
12296 #pragma omp taskyield
12297   }
12298 #pragma omp parallel sections
12299   {
12300 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}}
12301   }
12302 #pragma omp parallel sections
12303   {
12304 #pragma omp taskwait
12305   }
12306 #pragma omp parallel sections
12307   {
12308 #pragma omp flush
12309   }
12310 #pragma omp parallel sections
12311   {
12312 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
12313     bar();
12314   }
12315 #pragma omp parallel sections
12316   {
12317 #pragma omp atomic
12318     ++a;
12319   }
12320 #pragma omp parallel sections
12321   {
12322 #pragma omp target
12323     ++a;
12324   }
12325 #pragma omp parallel sections
12326   {
12327 #pragma omp target parallel
12328     ++a;
12329   }
12330 #pragma omp parallel sections
12331   {
12332 #pragma omp target parallel for
12333     for (int i = 0; i < 10; ++i)
12334       ;
12335   }
12336 #pragma omp parallel sections
12337   {
12338 #pragma omp target enter data map(to: a)
12339   }
12340 #pragma omp parallel sections
12341   {
12342 #pragma omp target exit data map(from: a)
12343   }
12344 #pragma omp parallel sections
12345   {
12346 #pragma omp teams // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
12347     ++a;
12348   }
12349 #pragma omp parallel sections
12350   {
12351 #pragma omp taskloop
12352   for (int i = 0; i < 10; ++i)
12353     ++a;
12354   }
12355 #pragma omp parallel sections
12356   {
12357 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
12358     for (int i = 0; i < 10; ++i)
12359       ;
12360   }
12361 #pragma omp parallel sections
12362   {
12363 #pragma omp target update to(a)
12364   }
12365 #pragma omp parallel sections
12366   {
12367 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
12368     for (int i = 0; i < 10; ++i)
12369       ;
12370   }
12371 #pragma omp parallel sections
12372   {
12373 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
12374     for (int i = 0; i < 10; ++i)
12375       ;
12376   }
12377 #pragma omp parallel sections
12378   {
12379 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
12380     for (int i = 0; i < 10; ++i)
12381       ;
12382   }
12383 #pragma omp parallel sections
12384   {
12385 #pragma omp target simd // OK
12386     for (int i = 0; i < 10; ++i)
12387       ;
12388   }
12389 #pragma omp parallel sections
12390   {
12391 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
12392     for (int i = 0; i < 10; ++i)
12393       ;
12394   }
12395 #pragma omp parallel sections
12396   {
12397 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
12398     for (int i = 0; i < 10; ++i)
12399       ;
12400   }
12401 #pragma omp parallel sections
12402   {
12403 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
12404     for (int i = 0; i < 10; ++i)
12405       ;
12406   }
12407 #pragma omp parallel sections
12408   {
12409 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
12410     for (int i = 0; i < 10; ++i)
12411       ;
12412   }
12413 #pragma omp parallel sections
12414   {
12415 #pragma omp target teams // OK
12416     a++;
12417   }
12418 #pragma omp parallel sections
12419   {
12420 #pragma omp target teams distribute // OK
12421     for (int i = 0; i < 10; ++i)
12422       ;
12423   }
12424 #pragma omp parallel sections
12425   {
12426 #pragma omp target teams distribute parallel for // OK
12427     for (int i = 0; i < 10; ++i)
12428       ;
12429   }
12430 #pragma omp parallel sections
12431   {
12432 #pragma omp target teams distribute parallel for simd // OK
12433     for (int i = 0; i < 10; ++i)
12434       ;
12435   }
12436 #pragma omp parallel sections
12437   {
12438 #pragma omp target teams distribute simd // OK
12439     for (int i = 0; i < 10; ++i)
12440       ;
12441   }
12442 
12443 // TASK DIRECTIVE
12444 #pragma omp task
12445 #pragma omp for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
12446   for (int i = 0; i < 10; ++i)
12447     ;
12448 #pragma omp task
12449 #pragma omp simd
12450   for (int i = 0; i < 10; ++i)
12451     ;
12452 #pragma omp task
12453 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
12454   for (int i = 0; i < 10; ++i)
12455     ;
12456 #pragma omp task
12457 #pragma omp sections // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
12458   {
12459     bar();
12460   }
12461 #pragma omp task
12462 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a task region}}
12463   {
12464     bar();
12465   }
12466 #pragma omp task
12467 #pragma omp single // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
12468   bar();
12469 #pragma omp task
12470 #pragma omp master // expected-error {{region cannot be closely nested inside 'task' region}}
12471   bar();
12472 #pragma omp task
12473 #pragma omp critical
12474   bar();
12475 #pragma omp task
12476 #pragma omp parallel for
12477   for (int i = 0; i < 10; ++i)
12478     ;
12479 #pragma omp task
12480 #pragma omp parallel for simd
12481   for (int i = 0; i < 10; ++i)
12482     ;
12483 #pragma omp task
12484 #pragma omp parallel sections
12485   {
12486     bar();
12487   }
12488 #pragma omp task
12489 #pragma omp task
12490   {
12491     bar();
12492   }
12493 #pragma omp task
12494   {
12495 #pragma omp taskyield
12496     bar();
12497   }
12498 #pragma omp task
12499   {
12500 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}}
12501     bar();
12502   }
12503 #pragma omp task
12504   {
12505 #pragma omp taskwait
12506     bar();
12507   }
12508 #pragma omp task
12509   {
12510 #pragma omp flush
12511     bar();
12512   }
12513 #pragma omp task
12514   {
12515 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
12516     bar();
12517   }
12518 #pragma omp task
12519   {
12520 #pragma omp atomic
12521     ++a;
12522   }
12523 #pragma omp task
12524   {
12525 #pragma omp target
12526     ++a;
12527   }
12528 #pragma omp task
12529   {
12530 #pragma omp target parallel
12531     ++a;
12532   }
12533 #pragma omp task
12534 #pragma omp target parallel for
12535   for (int i = 0; i < 10; ++i)
12536     ;
12537 #pragma omp task
12538   {
12539 #pragma omp target enter data map(to: a)
12540     ++a;
12541   }
12542 #pragma omp task
12543   {
12544 #pragma omp target exit data map(from: a)
12545     ++a;
12546   }
12547 #pragma omp task
12548   {
12549 #pragma omp teams // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
12550     ++a;
12551   }
12552 #pragma omp task
12553   {
12554 #pragma omp taskloop
12555   for (int i = 0; i < 10; ++i)
12556     ++a;
12557   }
12558 #pragma omp task
12559   {
12560 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
12561     for (int i = 0; i < 10; ++i)
12562       ;
12563   }
12564 #pragma omp task
12565   {
12566 #pragma omp target update to(a)
12567     a++;
12568   }
12569 #pragma omp task
12570   {
12571 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
12572     for (int i = 0; i < 10; ++i)
12573       ;
12574   }
12575 #pragma omp task
12576   {
12577 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
12578     for (int i = 0; i < 10; ++i)
12579       ;
12580   }
12581 #pragma omp task
12582   {
12583 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
12584     for (int i = 0; i < 10; ++i)
12585       ;
12586   }
12587 #pragma omp task
12588   {
12589 #pragma omp target simd // OK
12590     for (int i = 0; i < 10; ++i)
12591       ;
12592   }
12593 #pragma omp task
12594   {
12595 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
12596     for (int i = 0; i < 10; ++i)
12597       ;
12598   }
12599 #pragma omp task
12600   {
12601 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
12602     for (int i = 0; i < 10; ++i)
12603       ;
12604   }
12605 #pragma omp task
12606   {
12607 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
12608     for (int i = 0; i < 10; ++i)
12609       ;
12610   }
12611 #pragma omp task
12612   {
12613 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
12614     for (int i = 0; i < 10; ++i)
12615       ;
12616   }
12617 #pragma omp task
12618   {
12619 #pragma omp target teams // OK
12620     a++;
12621   }
12622 #pragma omp task
12623   {
12624 #pragma omp target teams distribute // OK
12625     for (int i = 0; i < 10; ++i)
12626       ;
12627   }
12628 #pragma omp task
12629   {
12630 #pragma omp target teams distribute parallel for // OK
12631     for (int i = 0; i < 10; ++i)
12632       ;
12633   }
12634 #pragma omp task
12635   {
12636 #pragma omp target teams distribute parallel for simd // OK
12637     for (int i = 0; i < 10; ++i)
12638       ;
12639   }
12640 #pragma omp task
12641   {
12642 #pragma omp target teams distribute simd // OK
12643     for (int i = 0; i < 10; ++i)
12644       ;
12645   }
12646 
12647 // ATOMIC DIRECTIVE
12648 #pragma omp atomic
12649   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12650   // expected-note@+1 {{expected an expression statement}}
12651   {
12652 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12653     for (int i = 0; i < 10; ++i)
12654       ;
12655   }
12656 #pragma omp atomic
12657   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12658   // expected-note@+1 {{expected an expression statement}}
12659   {
12660 #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12661     for (int i = 0; i < 10; ++i)
12662       ;
12663   }
12664 #pragma omp atomic
12665   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12666   // expected-note@+1 {{expected an expression statement}}
12667   {
12668 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12669     for (int i = 0; i < 10; ++i)
12670       ;
12671   }
12672 #pragma omp atomic
12673   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12674   // expected-note@+1 {{expected an expression statement}}
12675   {
12676 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12677     for (int i = 0; i < 10; ++i)
12678       ;
12679   }
12680 #pragma omp atomic
12681   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12682   // expected-note@+1 {{expected an expression statement}}
12683   {
12684 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12685     {
12686       bar();
12687     }
12688   }
12689 #pragma omp atomic
12690   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12691   // expected-note@+1 {{expected an expression statement}}
12692   {
12693 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12694     {
12695       bar();
12696     }
12697   }
12698 #pragma omp atomic
12699   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12700   // expected-note@+1 {{expected an expression statement}}
12701   {
12702 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12703     {
12704       bar();
12705     }
12706   }
12707 #pragma omp atomic
12708   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12709   // expected-note@+1 {{expected an expression statement}}
12710   {
12711 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12712     {
12713       bar();
12714     }
12715   }
12716 #pragma omp atomic
12717   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12718   // expected-note@+1 {{expected an expression statement}}
12719   {
12720 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12721     {
12722       bar();
12723     }
12724   }
12725 #pragma omp atomic
12726   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12727   // expected-note@+1 {{expected an expression statement}}
12728   {
12729 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12730     for (int i = 0; i < 10; ++i)
12731       ;
12732   }
12733 #pragma omp atomic
12734   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12735   // expected-note@+1 {{expected an expression statement}}
12736   {
12737 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12738     for (int i = 0; i < 10; ++i)
12739       ;
12740   }
12741 #pragma omp atomic
12742   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12743   // expected-note@+1 {{expected an expression statement}}
12744   {
12745 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12746     {
12747       bar();
12748     }
12749   }
12750 #pragma omp atomic
12751   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12752   // expected-note@+1 {{expected an expression statement}}
12753   {
12754 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12755     {
12756       bar();
12757     }
12758   }
12759 #pragma omp atomic
12760   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12761   // expected-note@+1 {{expected an expression statement}}
12762   {
12763 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12764     bar();
12765   }
12766 #pragma omp atomic
12767   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12768   // expected-note@+1 {{expected an expression statement}}
12769   {
12770 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12771     bar();
12772   }
12773 #pragma omp atomic
12774   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12775   // expected-note@+1 {{expected an expression statement}}
12776   {
12777 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12778     bar();
12779   }
12780 #pragma omp atomic
12781   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12782   // expected-note@+1 {{expected an expression statement}}
12783   {
12784 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12785     bar();
12786   }
12787 #pragma omp atomic
12788   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12789   // expected-note@+1 {{expected an expression statement}}
12790   {
12791 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12792     bar();
12793   }
12794 #pragma omp atomic
12795   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12796   // expected-note@+1 {{expected an expression statement}}
12797   {
12798 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12799     ++a;
12800   }
12801 #pragma omp atomic
12802   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12803   // expected-note@+1 {{expected an expression statement}}
12804   {
12805 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12806     ++a;
12807   }
12808 #pragma omp atomic
12809   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12810   // expected-note@+1 {{expected an expression statement}}
12811   {
12812 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12813     ++a;
12814   }
12815 #pragma omp atomic
12816   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12817   // expected-note@+1 {{expected an expression statement}}
12818   {
12819 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12820     for (int i = 0; i < 10; ++i)
12821       ;
12822   }
12823 #pragma omp atomic
12824   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12825   // expected-note@+1 {{expected an expression statement}}
12826   {
12827 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12828     ++a;
12829   }
12830 #pragma omp atomic
12831   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12832   // expected-note@+1 {{expected an expression statement}}
12833   {
12834 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12835     ++a;
12836   }
12837 #pragma omp atomic
12838   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12839   // expected-note@+1 {{expected an expression statement}}
12840   {
12841 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12842     ++a;
12843   }
12844 #pragma omp atomic
12845   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12846   // expected-note@+1 {{expected an expression statement}}
12847   {
12848 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12849   for (int i = 0; i < 10; ++i)
12850     ++a;
12851   }
12852 #pragma omp atomic
12853   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12854   // expected-note@+1 {{expected an expression statement}}
12855   {
12856 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12857     for (int i = 0; i < 10; ++i)
12858       ;
12859   }
12860 #pragma omp atomic
12861   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12862   // expected-note@+1 {{expected an expression statement}}
12863   {
12864 #pragma omp target update // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12865   }
12866 #pragma omp atomic
12867   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12868   // expected-note@+1 {{expected an expression statement}}
12869   {
12870 #pragma omp distribute parallel for// expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12871     for (int i = 0; i < 10; ++i)
12872       ;
12873   }
12874 #pragma omp atomic
12875   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12876   // expected-note@+1 {{expected an expression statement}}
12877   {
12878 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12879     for (int i = 0; i < 10; ++i)
12880       ;
12881   }
12882 #pragma omp atomic
12883   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12884   // expected-note@+1 {{expected an expression statement}}
12885   {
12886 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12887     for (int i = 0; i < 10; ++i)
12888       ;
12889   }
12890 #pragma omp atomic
12891   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12892   // expected-note@+1 {{expected an expression statement}}
12893   {
12894 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12895     for (int i = 0; i < 10; ++i)
12896       ;
12897   }
12898 #pragma omp atomic
12899   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12900   // expected-note@+1 {{expected an expression statement}}
12901   {
12902 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12903     for (int i = 0; i < 10; ++i)
12904       ;
12905   }
12906 #pragma omp atomic
12907   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12908   // expected-note@+1 {{expected an expression statement}}
12909   {
12910 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12911     for (int i = 0; i < 10; ++i)
12912       ;
12913   }
12914 #pragma omp atomic
12915   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12916   // expected-note@+1 {{expected an expression statement}}
12917   {
12918 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12919     for (int i = 0; i < 10; ++i)
12920       ;
12921   }
12922 #pragma omp atomic
12923   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12924   // expected-note@+1 {{expected an expression statement}}
12925   {
12926 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12927     for (int i = 0; i < 10; ++i)
12928       ;
12929   }
12930 #pragma omp atomic
12931   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12932   // expected-note@+1 {{expected an expression statement}}
12933   {
12934 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12935     a++;
12936   }
12937 #pragma omp atomic
12938   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12939   // expected-note@+1 {{expected an expression statement}}
12940   {
12941 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12942     for (int i = 0; i < 10; ++i)
12943       ;
12944   }
12945 #pragma omp atomic
12946   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12947   // expected-note@+1 {{expected an expression statement}}
12948   {
12949 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12950     for (int i = 0; i < 10; ++i)
12951       ;
12952   }
12953 #pragma omp atomic
12954   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12955   // expected-note@+1 {{expected an expression statement}}
12956   {
12957 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12958     for (int i = 0; i < 10; ++i)
12959       ;
12960   }
12961 #pragma omp atomic
12962   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
12963   // expected-note@+1 {{expected an expression statement}}
12964   {
12965 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12966     for (int i = 0; i < 10; ++i)
12967       ;
12968   }
12969 
12970 // TARGET DIRECTIVE
12971 #pragma omp target
12972 #pragma omp parallel
12973   bar();
12974 #pragma omp target
12975 #pragma omp for
12976   for (int i = 0; i < 10; ++i)
12977     ;
12978 #pragma omp target
12979 #pragma omp simd
12980   for (int i = 0; i < 10; ++i)
12981     ;
12982 #pragma omp target
12983 #pragma omp for simd
12984   for (int i = 0; i < 10; ++i)
12985     ;
12986 #pragma omp target
12987 #pragma omp sections
12988   {
12989     bar();
12990   }
12991 #pragma omp target
12992 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target region}}
12993   {
12994     bar();
12995   }
12996 #pragma omp target
12997 #pragma omp single
12998   bar();
12999 
13000 #pragma omp target
13001 #pragma omp master
13002   {
13003     bar();
13004   }
13005 #pragma omp target
13006 #pragma omp critical
13007   {
13008     bar();
13009   }
13010 #pragma omp target
13011 #pragma omp parallel for
13012   for (int i = 0; i < 10; ++i)
13013     ;
13014 #pragma omp target
13015 #pragma omp parallel for simd
13016   for (int i = 0; i < 10; ++i)
13017     ;
13018 #pragma omp target
13019 #pragma omp parallel sections
13020   {
13021     bar();
13022   }
13023 #pragma omp target
13024 #pragma omp task
13025   {
13026     bar();
13027   }
13028 #pragma omp target
13029   {
13030 #pragma omp taskyield
13031     bar();
13032   }
13033 #pragma omp target
13034   {
13035 #pragma omp barrier
13036     bar();
13037   }
13038 #pragma omp target
13039   {
13040 #pragma omp taskwait
13041     bar();
13042   }
13043 #pragma omp target
13044   {
13045 #pragma omp flush
13046     bar();
13047   }
13048 #pragma omp target
13049   {
13050 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
13051     bar();
13052   }
13053 #pragma omp target
13054   {
13055 #pragma omp atomic
13056     ++a;
13057   }
13058 #pragma omp target
13059   {
13060 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
13061     ++a;
13062   }
13063 #pragma omp target
13064   {
13065 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
13066     ++a;
13067   }
13068 #pragma omp target
13069 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
13070   for (int i = 0; i < 10; ++i)
13071     ;
13072 #pragma omp target
13073   {
13074 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
13075   }
13076 #pragma omp target
13077   {
13078 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
13079   }
13080 #pragma omp target
13081   {
13082 #pragma omp teams
13083     ++a;
13084   }
13085 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
13086   {
13087 #pragma omp teams // expected-note {{directive outside teams construct here}}
13088     ++a;
13089 #pragma omp teams // expected-note {{nested teams construct here}}
13090     ++a;
13091   }
13092 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
13093   {
13094     ++a;          // expected-note {{statement outside teams construct here}}
13095 #pragma omp teams // expected-note {{nested teams construct here}}
13096     ++a;
13097   }
13098 #pragma omp target
13099   {
13100 #pragma omp taskloop
13101   for (int i = 0; i < 10; ++i)
13102     ++a;
13103   }
13104 #pragma omp target
13105   {
13106 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
13107     for (int i = 0; i < 10; ++i)
13108       ;
13109   }
13110 #pragma omp atomic
13111   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
13112   // expected-note@+1 {{expected an expression statement}}
13113   {
13114 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
13115     a++;
13116   }
13117 #pragma omp target
13118   {
13119 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
13120     for (int i = 0; i < 10; ++i)
13121       ;
13122   }
13123 #pragma omp target
13124   {
13125 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
13126     for (int i = 0; i < 10; ++i)
13127       ;
13128   }
13129 #pragma omp target
13130   {
13131 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
13132     for (int i = 0; i < 10; ++i)
13133       ;
13134   }
13135 #pragma omp target
13136   {
13137 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
13138     for (int i = 0; i < 10; ++i)
13139       ;
13140   }
13141 #pragma omp target
13142   {
13143 #pragma omp teams distribute // OK
13144     for (int i = 0; i < 10; ++i)
13145       ;
13146   }
13147 #pragma omp target
13148   {
13149 #pragma omp teams distribute simd // OK
13150     for (int i = 0; i < 10; ++i)
13151       ;
13152   }
13153 #pragma omp target
13154   {
13155 #pragma omp teams distribute parallel for simd // OK
13156     for (int i = 0; i < 10; ++i)
13157       ;
13158   }
13159 #pragma omp target
13160   {
13161 #pragma omp teams distribute parallel for // OK
13162     for (int i = 0; i < 10; ++i)
13163       ;
13164   }
13165 #pragma omp target
13166   {
13167 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
13168     a++;
13169   }
13170 #pragma omp target
13171   {
13172 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
13173     for (int i = 0; i < 10; ++i)
13174       ;
13175   }
13176 #pragma omp target
13177   {
13178 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
13179     for (int i = 0; i < 10; ++i)
13180       ;
13181   }
13182 #pragma omp target
13183   {
13184 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
13185     for (int i = 0; i < 10; ++i)
13186       ;
13187   }
13188 #pragma omp target
13189   {
13190 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
13191     for (int i = 0; i < 10; ++i)
13192       ;
13193   }
13194 
13195 // TARGET PARALLEL DIRECTIVE
13196 #pragma omp target parallel
13197 #pragma omp parallel
13198   bar();
13199 #pragma omp target parallel
13200 #pragma omp for
13201   for (int i = 0; i < 10; ++i)
13202     ;
13203 #pragma omp target parallel
13204 #pragma omp simd
13205   for (int i = 0; i < 10; ++i)
13206     ;
13207 #pragma omp target parallel
13208 #pragma omp for simd
13209   for (int i = 0; i < 10; ++i)
13210     ;
13211 #pragma omp target parallel
13212 #pragma omp sections
13213   {
13214     bar();
13215   }
13216 #pragma omp target parallel
13217 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel region}}
13218   {
13219     bar();
13220   }
13221 #pragma omp target parallel
13222 #pragma omp single
13223   bar();
13224 
13225 #pragma omp target parallel
13226 #pragma omp master
13227   {
13228     bar();
13229   }
13230 #pragma omp target parallel
13231 #pragma omp critical
13232   {
13233     bar();
13234   }
13235 #pragma omp target parallel
13236 #pragma omp parallel for
13237   for (int i = 0; i < 10; ++i)
13238     ;
13239 #pragma omp target parallel
13240 #pragma omp parallel for simd
13241   for (int i = 0; i < 10; ++i)
13242     ;
13243 #pragma omp target parallel
13244 #pragma omp parallel sections
13245   {
13246     bar();
13247   }
13248 #pragma omp target parallel
13249 #pragma omp task
13250   {
13251     bar();
13252   }
13253 #pragma omp target parallel
13254   {
13255 #pragma omp taskyield
13256     bar();
13257   }
13258 #pragma omp target parallel
13259   {
13260 #pragma omp barrier
13261     bar();
13262   }
13263 #pragma omp target parallel
13264   {
13265 #pragma omp taskwait
13266     bar();
13267   }
13268 #pragma omp target parallel
13269   {
13270 #pragma omp flush
13271     bar();
13272   }
13273 #pragma omp target parallel
13274   {
13275 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
13276     bar();
13277   }
13278 #pragma omp target parallel
13279   {
13280 #pragma omp atomic
13281     ++a;
13282   }
13283 #pragma omp target parallel
13284   {
13285 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel' region}}
13286     ++a;
13287   }
13288 #pragma omp target parallel
13289   {
13290 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel' region}}
13291     ++a;
13292   }
13293 #pragma omp target parallel
13294 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel' region}}
13295   for (int i = 0; i < 10; ++i)
13296     ;
13297 #pragma omp target parallel
13298   {
13299 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
13300     ++a;
13301   }
13302 #pragma omp target parallel
13303   {
13304     ++a;
13305 #pragma omp teams  // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
13306     ++a;
13307   }
13308 #pragma omp target parallel
13309   {
13310 #pragma omp taskloop
13311   for (int i = 0; i < 10; ++i)
13312     ++a;
13313   }
13314 #pragma omp target parallel
13315   {
13316 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
13317     for (int i = 0; i < 10; ++i)
13318       ;
13319   }
13320 #pragma omp target parallel
13321   {
13322 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel' region}}
13323   }
13324 #pragma omp target parallel
13325   {
13326 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel' region}}
13327   }
13328 #pragma omp target parallel
13329   {
13330 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel' region}}
13331   }
13332 #pragma omp target parallel
13333   {
13334 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
13335     for (int i = 0; i < 10; ++i)
13336       ;
13337   }
13338 #pragma omp target parallel
13339   {
13340 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
13341     for (int i = 0; i < 10; ++i)
13342       ;
13343   }
13344 #pragma omp target parallel
13345   {
13346 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
13347     for (int i = 0; i < 10; ++i)
13348       ;
13349   }
13350 #pragma omp target parallel
13351   {
13352 #pragma omp target simd // expected-error {{region cannot be nested inside 'target parallel' regio}}
13353     for (int i = 0; i < 10; ++i)
13354       ;
13355   }
13356 #pragma omp target parallel
13357   {
13358 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
13359     for (int i = 0; i < 10; ++i)
13360       ;
13361   }
13362 #pragma omp target parallel
13363   {
13364 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
13365     for (int i = 0; i < 10; ++i)
13366       ;
13367   }
13368 #pragma omp target parallel
13369   {
13370 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
13371     for (int i = 0; i < 10; ++i)
13372       ;
13373   }
13374 #pragma omp target parallel
13375   {
13376 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
13377     for (int i = 0; i < 10; ++i)
13378       ;
13379   }
13380 #pragma omp target parallel
13381   {
13382 #pragma omp target teams // expected-error {{region cannot be nested inside 'target parallel' region}}
13383     a++;
13384   }
13385 #pragma omp target parallel
13386   {
13387 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target parallel' region}}
13388     for (int i = 0; i < 10; ++i)
13389       ;
13390   }
13391 #pragma omp target parallel
13392   {
13393 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target parallel' region}}
13394     for (int i = 0; i < 10; ++i)
13395       ;
13396   }
13397 #pragma omp target parallel
13398   {
13399 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target parallel' region}}
13400     for (int i = 0; i < 10; ++i)
13401       ;
13402   }
13403 #pragma omp target parallel
13404   {
13405 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target parallel' region}}
13406     for (int i = 0; i < 10; ++i)
13407       ;
13408   }
13409 
13410 // TARGET PARALLEL FOR DIRECTIVE
13411 #pragma omp target parallel for
13412   for (int i = 0; i < 10; ++i) {
13413 #pragma omp for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
13414     for (int i = 0; i < 10; ++i)
13415       ;
13416   }
13417 #pragma omp target parallel for
13418   for (int i = 0; i < 10; ++i) {
13419 #pragma omp simd
13420     for (int i = 0; i < 10; ++i)
13421       ;
13422   }
13423 #pragma omp target parallel for
13424   for (int i = 0; i < 10; ++i) {
13425 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
13426     for (int i = 0; i < 10; ++i)
13427       ;
13428   }
13429 #pragma omp target parallel for
13430   for (int i = 0; i < 10; ++i) {
13431 #pragma omp parallel
13432     for (int i = 0; i < 10; ++i)
13433       ;
13434   }
13435 #pragma omp target parallel for
13436   for (int i = 0; i < 10; ++i) {
13437 #pragma omp sections // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
13438     {
13439       bar();
13440     }
13441   }
13442 #pragma omp target parallel for
13443   for (int i = 0; i < 10; ++i) {
13444 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel for region}}
13445     {
13446       bar();
13447     }
13448   }
13449 #pragma omp target parallel for
13450   for (int i = 0; i < 10; ++i) {
13451 #pragma omp single // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
13452     {
13453       bar();
13454     }
13455   }
13456 
13457 #pragma omp target parallel for
13458   for (int i = 0; i < 10; ++i) {
13459 #pragma omp master // expected-error {{region cannot be closely nested inside 'target parallel for' region}}
13460     {
13461       bar();
13462     }
13463   }
13464 
13465 #pragma omp target parallel for
13466   for (int i = 0; i < 10; ++i) {
13467 #pragma omp critical
13468     {
13469       bar();
13470     }
13471   }
13472 
13473 #pragma omp target parallel for
13474   for (int i = 0; i < 10; ++i) {
13475 #pragma omp parallel
13476     {
13477 #pragma omp single // OK
13478       {
13479         bar();
13480       }
13481 #pragma omp for // OK
13482       for (int i = 0; i < 10; ++i)
13483         ;
13484 #pragma omp for simd // OK
13485       for (int i = 0; i < 10; ++i)
13486         ;
13487 #pragma omp sections // OK
13488       {
13489         bar();
13490       }
13491     }
13492   }
13493 #pragma omp target parallel for
13494   for (int i = 0; i < 10; ++i) {
13495 #pragma omp parallel for
13496     for (int i = 0; i < 10; ++i)
13497       ;
13498   }
13499 #pragma omp target parallel for
13500   for (int i = 0; i < 10; ++i) {
13501 #pragma omp parallel for simd
13502     for (int i = 0; i < 10; ++i)
13503       ;
13504   }
13505 #pragma omp target parallel for
13506   for (int i = 0; i < 10; ++i) {
13507 #pragma omp parallel sections
13508     {
13509       bar();
13510     }
13511   }
13512 #pragma omp target parallel for
13513   for (int i = 0; i < 10; ++i) {
13514 #pragma omp task
13515     {
13516       bar();
13517     }
13518   }
13519 #pragma omp target parallel for
13520   for (int i = 0; i < 10; ++i) {
13521 #pragma omp taskyield
13522     bar();
13523   }
13524 #pragma omp target parallel for
13525   for (int i = 0; i < 10; ++i) {
13526 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target parallel for' region}}
13527     bar();
13528   }
13529 #pragma omp target parallel for
13530   for (int i = 0; i < 10; ++i) {
13531 #pragma omp taskwait
13532     bar();
13533   }
13534 #pragma omp target parallel for
13535   for (int i = 0; i < 10; ++i) {
13536 #pragma omp flush
13537     bar();
13538   }
13539 #pragma omp target parallel for
13540   for (int i = 0; i < 10; ++i) {
13541 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
13542     bar();
13543   }
13544 #pragma omp target parallel for ordered
13545   for (int i = 0; i < 10; ++i) {
13546 #pragma omp ordered // OK
13547     bar();
13548   }
13549 #pragma omp target parallel for
13550   for (int i = 0; i < 10; ++i) {
13551 #pragma omp atomic
13552     ++a;
13553   }
13554 #pragma omp target parallel for
13555   for (int i = 0; i < 10; ++i) {
13556 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel for' region}}
13557     ++a;
13558   }
13559 #pragma omp target parallel for
13560   for (int i = 0; i < 10; ++i) {
13561 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel for' region}}
13562     ++a;
13563   }
13564 #pragma omp target parallel for
13565   for (int i = 0; i < 10; ++i) {
13566 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}}
13567     for (int i = 0; i < 10; ++i)
13568       ;
13569   }
13570 #pragma omp target parallel for
13571   for (int i = 0; i < 10; ++i) {
13572 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
13573     ++a;
13574   }
13575 #pragma omp target parallel for
13576   for (int i = 0; i < 10; ++i) {
13577 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
13578     ++a;
13579   }
13580 #pragma omp target parallel for
13581   for (int i = 0; i < 10; ++i) {
13582 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
13583     ++a;
13584   }
13585 #pragma omp target parallel for
13586   for (int i = 0; i < 10; ++i) {
13587 #pragma omp taskloop
13588   for (int i = 0; i < 10; ++i)
13589     ++a;
13590   }
13591 #pragma omp target parallel for
13592   for (int i = 0; i < 10; ++i) {
13593 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
13594     for (int j = 0; j < 10; ++j)
13595       ;
13596   }
13597 #pragma omp target parallel for
13598   for (int i = 0; i < 10; ++i) {
13599 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
13600     a++;
13601   }
13602 #pragma omp target parallel for
13603   for (int i = 0; i < 10; ++i) {
13604 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
13605     for (int j = 0; j < 10; ++j)
13606       ;
13607   }
13608 #pragma omp target parallel for
13609   for (int i = 0; i < 10; ++i) {
13610 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
13611     for (int j = 0; j < 10; ++j)
13612       ;
13613   }
13614 #pragma omp target parallel for
13615   for (int i = 0; i < 10; ++i) {
13616 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
13617     for (int j = 0; j < 10; ++j)
13618       ;
13619   }
13620 #pragma omp target parallel for
13621   for (int i = 0; i < 10; ++i) {
13622 #pragma omp target simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
13623     for (int j = 0; j < 10; ++j)
13624       ;
13625   }
13626 #pragma omp target parallel for
13627   for (int i = 0; i < 10; ++i) {
13628 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
13629     for (int j = 0; j < 10; ++j)
13630       ;
13631   }
13632 #pragma omp target parallel for
13633   for (int i = 0; i < 10; ++i) {
13634 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
13635     for (int j = 0; j < 10; ++j)
13636       ;
13637   }
13638 #pragma omp target parallel for
13639   for (int i = 0; i < 10; ++i) {
13640 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
13641     for (int j = 0; j < 10; ++j)
13642       ;
13643   }
13644 #pragma omp target parallel for
13645   for (int i = 0; i < 10; ++i) {
13646 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
13647     for (int j = 0; j < 10; ++j)
13648       ;
13649   }
13650 #pragma omp target parallel for
13651   for (int i = 0; i < 10; ++i) {
13652 #pragma omp target teams // expected-error {{region cannot be nested inside 'target parallel for' region}}
13653     a++;
13654   }
13655 #pragma omp target parallel for
13656   for (int i = 0; i < 10; ++i) {
13657 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target parallel for' region}}
13658     for (int j = 0; j < 10; ++j)
13659       ;
13660   }
13661 #pragma omp target parallel for
13662   for (int i = 0; i < 10; ++i) {
13663 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}}
13664     for (int j = 0; j < 10; ++j)
13665       ;
13666   }
13667 #pragma omp target parallel for
13668   for (int i = 0; i < 10; ++i) {
13669 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
13670     for (int j = 0; j < 10; ++j)
13671       ;
13672   }
13673 #pragma omp target parallel for
13674   for (int i = 0; i < 10; ++i) {
13675 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
13676     for (int j = 0; j < 10; ++j)
13677       ;
13678   }
13679 
13680 // TEAMS DIRECTIVE
13681 #pragma omp target
13682 #pragma omp teams
13683 #pragma omp parallel
13684   bar();
13685 #pragma omp target
13686 #pragma omp teams
13687 #pragma omp for // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
13688   for (int i = 0; i < 10; ++i)
13689     ;
13690 #pragma omp target
13691 #pragma omp teams
13692 #pragma omp simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp simd' directive into a parallel region?}}
13693   for (int i = 0; i < 10; ++i)
13694     ;
13695 #pragma omp target
13696 #pragma omp teams
13697 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
13698   for (int i = 0; i < 10; ++i)
13699     ;
13700 #pragma omp target
13701 #pragma omp teams
13702 #pragma omp sections // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
13703   {
13704     bar();
13705   }
13706 #pragma omp target
13707 #pragma omp teams
13708 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams region}}
13709   {
13710     bar();
13711   }
13712 #pragma omp target
13713 #pragma omp teams
13714 #pragma omp single // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
13715   bar();
13716 
13717 #pragma omp target
13718 #pragma omp teams
13719 #pragma omp master // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp master' directive into a parallel region?}}
13720   {
13721     bar();
13722   }
13723 #pragma omp target
13724 #pragma omp teams
13725 #pragma omp critical // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp critical' directive into a parallel region?}}
13726   {
13727     bar();
13728   }
13729 #pragma omp target
13730 #pragma omp teams
13731 #pragma omp parallel for
13732   for (int i = 0; i < 10; ++i)
13733     ;
13734 #pragma omp target
13735 #pragma omp teams
13736 #pragma omp parallel for simd
13737   for (int i = 0; i < 10; ++i)
13738     ;
13739 #pragma omp target
13740 #pragma omp teams
13741 #pragma omp parallel sections
13742   {
13743     bar();
13744   }
13745 #pragma omp target
13746 #pragma omp teams
13747 #pragma omp task // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp task' directive into a parallel region?}}
13748   {
13749     bar();
13750   }
13751 #pragma omp target
13752 #pragma omp teams
13753   {
13754 #pragma omp taskyield // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskyield' directive into a parallel region?}}
13755     bar();
13756   }
13757 #pragma omp target
13758 #pragma omp teams
13759   {
13760 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp barrier' directive into a parallel region?}}
13761     bar();
13762   }
13763 #pragma omp target
13764 #pragma omp teams
13765   {
13766 #pragma omp taskwait // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskwait' directive into a parallel region?}}
13767     bar();
13768   }
13769 #pragma omp target
13770 #pragma omp teams
13771   {
13772 #pragma omp flush // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp flush' directive into a parallel region?}}
13773     bar();
13774   }
13775 #pragma omp target
13776 #pragma omp teams
13777   {
13778 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
13779     bar();
13780   }
13781 #pragma omp target
13782 #pragma omp teams
13783   {
13784 #pragma omp atomic // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp atomic' directive into a parallel region?}}
13785     ++a;
13786   }
13787 #pragma omp target
13788 #pragma omp teams
13789   {
13790 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
13791     ++a;
13792   }
13793 #pragma omp target
13794 #pragma omp teams
13795   {
13796 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
13797     ++a;
13798   }
13799 #pragma omp target
13800 #pragma omp teams
13801 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
13802   for (int i = 0; i < 10; ++i)
13803     ;
13804 #pragma omp target
13805 #pragma omp teams
13806   {
13807 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
13808   }
13809 #pragma omp target
13810 #pragma omp teams
13811   {
13812 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
13813   }
13814 #pragma omp target
13815 #pragma omp teams
13816   {
13817 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
13818     ++a;
13819   }
13820 #pragma omp target
13821 #pragma omp teams
13822   {
13823 #pragma omp taskloop // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp taskloop' directive into a parallel region?}}
13824   for (int i = 0; i < 10; ++i)
13825     ++a;
13826   }
13827 #pragma omp target
13828 #pragma omp teams
13829 #pragma omp distribute
13830   for (int i = 0; i < 10; ++i)
13831     ;
13832 #pragma omp target
13833 #pragma omp teams
13834 #pragma omp distribute
13835   for (int i = 0; i < 10; ++i)
13836     ;
13837 #pragma omp distribute
13838   for (int j = 0; j < 10; ++j)
13839     ;
13840 #pragma omp target
13841 #pragma omp teams
13842   {
13843 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
13844     ++a;
13845   }
13846 #pragma omp target
13847 #pragma omp teams
13848 #pragma omp distribute parallel for
13849   for (int i = 0; i < 10; ++i)
13850     ;
13851 #pragma omp target
13852 #pragma omp teams
13853   {
13854 #pragma omp distribute parallel for
13855   for (int i = 0; i < 10; ++i)
13856     ;
13857 #pragma omp distribute parallel for
13858   for (int j = 0; j < 10; ++j)
13859     ;
13860   }
13861 #pragma omp target
13862 #pragma omp teams
13863   {
13864 #pragma omp distribute parallel for simd
13865   for (int i = 0; i < 10; ++i)
13866     ;
13867 #pragma omp distribute parallel for simd
13868   for (int j = 0; j < 10; ++j)
13869     ;
13870   }
13871 #pragma omp target
13872 #pragma omp teams
13873   {
13874 #pragma omp distribute simd
13875   for (int i = 0; i < 10; ++i)
13876     ;
13877 #pragma omp distribute simd
13878   for (int j = 0; j < 10; ++j)
13879     ;
13880   }
13881 #pragma omp target
13882 #pragma omp teams
13883   {
13884 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
13885   for (int i = 0; i < 10; ++i)
13886     ;
13887   }
13888 #pragma omp target
13889 #pragma omp teams
13890   {
13891 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
13892   for (int i = 0; i < 10; ++i)
13893     ;
13894   }
13895 #pragma omp target
13896 #pragma omp teams
13897   {
13898 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
13899   for (int i = 0; i < 10; ++i)
13900     ;
13901   }
13902 #pragma omp target
13903 #pragma omp teams
13904   {
13905 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
13906   for (int i = 0; i < 10; ++i)
13907     ;
13908   }
13909 #pragma omp target
13910 #pragma omp teams
13911   {
13912 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'teams' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
13913   for (int i = 0; i < 10; ++i)
13914     ;
13915   }
13916 #pragma omp target
13917 #pragma omp teams
13918   {
13919 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
13920     a++;
13921   }
13922 #pragma omp target
13923 #pragma omp teams
13924   {
13925 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
13926   for (int i = 0; i < 10; ++i)
13927     ;
13928   }
13929 #pragma omp target
13930 #pragma omp teams
13931   {
13932 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
13933   for (int i = 0; i < 10; ++i)
13934     ;
13935   }
13936 #pragma omp target
13937 #pragma omp teams
13938   {
13939 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
13940   for (int i = 0; i < 10; ++i)
13941     ;
13942   }
13943 #pragma omp target
13944 #pragma omp teams
13945   {
13946 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
13947   for (int i = 0; i < 10; ++i)
13948     ;
13949   }
13950 
13951 // TASKLOOP DIRECTIVE
13952 #pragma omp taskloop
13953   for (int i = 0; i < 10; ++i) {
13954 #pragma omp for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
13955     for (int i = 0; i < 10; ++i)
13956       ;
13957   }
13958 #pragma omp taskloop
13959   for (int i = 0; i < 10; ++i) {
13960 #pragma omp simd
13961     for (int i = 0; i < 10; ++i)
13962       ;
13963   }
13964 #pragma omp taskloop
13965   for (int i = 0; i < 10; ++i) {
13966 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
13967     for (int i = 0; i < 10; ++i)
13968       ;
13969   }
13970 #pragma omp taskloop
13971   for (int i = 0; i < 10; ++i) {
13972 #pragma omp parallel
13973     for (int i = 0; i < 10; ++i)
13974       ;
13975   }
13976 #pragma omp taskloop
13977   for (int i = 0; i < 10; ++i) {
13978 #pragma omp sections // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
13979     {
13980       bar();
13981     }
13982   }
13983 #pragma omp taskloop
13984   for (int i = 0; i < 10; ++i) {
13985 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a taskloop region}}
13986     {
13987       bar();
13988     }
13989   }
13990 #pragma omp taskloop
13991   for (int i = 0; i < 10; ++i) {
13992 #pragma omp single // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
13993     {
13994       bar();
13995     }
13996   }
13997 
13998 #pragma omp taskloop
13999   for (int i = 0; i < 10; ++i) {
14000 #pragma omp master // expected-error {{region cannot be closely nested inside 'taskloop' region}}
14001     {
14002       bar();
14003     }
14004   }
14005 #pragma omp taskloop
14006   for (int i = 0; i < 10; ++i) {
14007 #pragma omp critical
14008     {
14009       bar();
14010     }
14011   }
14012 #pragma omp taskloop
14013   for (int i = 0; i < 10; ++i) {
14014 #pragma omp parallel
14015     {
14016 #pragma omp single // OK
14017       {
14018         bar();
14019       }
14020 #pragma omp for // OK
14021       for (int i = 0; i < 10; ++i)
14022         ;
14023 #pragma omp sections // OK
14024       {
14025         bar();
14026       }
14027     }
14028   }
14029 #pragma omp taskloop
14030   for (int i = 0; i < 10; ++i) {
14031 #pragma omp parallel for
14032     for (int i = 0; i < 10; ++i)
14033       ;
14034   }
14035 #pragma omp taskloop
14036   for (int i = 0; i < 10; ++i) {
14037 #pragma omp parallel for simd
14038     for (int i = 0; i < 10; ++i)
14039       ;
14040   }
14041 #pragma omp taskloop
14042   for (int i = 0; i < 10; ++i) {
14043 #pragma omp parallel sections
14044     {
14045       bar();
14046     }
14047   }
14048 #pragma omp taskloop
14049   for (int i = 0; i < 10; ++i) {
14050 #pragma omp task
14051     {
14052       bar();
14053     }
14054   }
14055 #pragma omp taskloop
14056   for (int i = 0; i < 10; ++i) {
14057 #pragma omp taskyield
14058     bar();
14059   }
14060 #pragma omp taskloop
14061   for (int i = 0; i < 10; ++i) {
14062 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'taskloop' region}}
14063     bar();
14064   }
14065 #pragma omp taskloop
14066   for (int i = 0; i < 10; ++i) {
14067 #pragma omp taskwait
14068     bar();
14069   }
14070 #pragma omp taskloop
14071   for (int i = 0; i < 10; ++i) {
14072 #pragma omp flush
14073     bar();
14074   }
14075 #pragma omp taskloop
14076   for (int i = 0; i < 10; ++i) {
14077 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
14078     bar();
14079   }
14080 #pragma omp taskloop
14081   for (int i = 0; i < 10; ++i) {
14082 #pragma omp atomic
14083     ++a;
14084   }
14085 #pragma omp taskloop
14086   for (int i = 0; i < 10; ++i) {
14087 #pragma omp target
14088     ++a;
14089   }
14090 #pragma omp taskloop
14091   for (int i = 0; i < 10; ++i) {
14092 #pragma omp target parallel
14093     ++a;
14094   }
14095 #pragma omp taskloop
14096   for (int i = 0; i < 10; ++i) {
14097 #pragma omp target parallel for
14098     for (int i = 0; i < 10; ++i)
14099       ;
14100   }
14101 #pragma omp taskloop
14102   for (int i = 0; i < 10; ++i) {
14103 #pragma omp target enter data map(to: a)
14104     ++a;
14105   }
14106 #pragma omp taskloop
14107   for (int i = 0; i < 10; ++i) {
14108 #pragma omp target exit data map(from: a)
14109     ++a;
14110   }
14111 #pragma omp taskloop
14112   for (int i = 0; i < 10; ++i) {
14113 #pragma omp teams // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
14114     ++a;
14115   }
14116 #pragma omp taskloop
14117   for (int i = 0; i < 10; ++i) {
14118 #pragma omp taskloop
14119   for (int i = 0; i < 10; ++i)
14120     ++a;
14121   }
14122 #pragma omp taskloop
14123   for (int i = 0; i < 10; ++i) {
14124 #pragma omp target update to(a)
14125     ++a;
14126   }
14127 #pragma omp taskloop
14128   for (int i = 0; i < 10; ++i) {
14129 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
14130     for (int i = 0; i < 10; ++i)
14131       ;
14132   }
14133 #pragma omp taskloop
14134   for (int i = 0; i < 10; ++i) {
14135 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
14136     for (int i = 0; i < 10; ++i)
14137       ;
14138   }
14139 #pragma omp taskloop
14140   for (int i = 0; i < 10; ++i) {
14141 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
14142     for (int i = 0; i < 10; ++i)
14143       ;
14144   }
14145 #pragma omp taskloop
14146   for (int i = 0; i < 10; ++i) {
14147 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
14148     for (int i = 0; i < 10; ++i)
14149       ;
14150   }
14151 #pragma omp taskloop
14152   for (int i = 0; i < 10; ++i) {
14153 #pragma omp target simd // OK
14154     for (int i = 0; i < 10; ++i)
14155       ;
14156   }
14157 #pragma omp taskloop
14158   for (int i = 0; i < 10; ++i) {
14159 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
14160     for (int i = 0; i < 10; ++i)
14161       ;
14162   }
14163 #pragma omp taskloop
14164   for (int i = 0; i < 10; ++i) {
14165 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
14166     for (int i = 0; i < 10; ++i)
14167       ;
14168   }
14169 #pragma omp taskloop
14170   for (int i = 0; i < 10; ++i) {
14171 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
14172     for (int i = 0; i < 10; ++i)
14173       ;
14174   }
14175 #pragma omp taskloop
14176   for (int i = 0; i < 10; ++i) {
14177 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'taskloop' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
14178     for (int i = 0; i < 10; ++i)
14179       ;
14180   }
14181 #pragma omp taskloop
14182   for (int i = 0; i < 10; ++i) {
14183 #pragma omp target teams // OK
14184     a++;
14185   }
14186 #pragma omp taskloop
14187   for (int i = 0; i < 10; ++i) {
14188 #pragma omp target teams distribute // OK
14189     for (int i = 0; i < 10; ++i)
14190       ;
14191   }
14192 #pragma omp taskloop
14193   for (int i = 0; i < 10; ++i) {
14194 #pragma omp target teams distribute parallel for // OK
14195     for (int i = 0; i < 10; ++i)
14196       ;
14197   }
14198 #pragma omp taskloop
14199   for (int i = 0; i < 10; ++i) {
14200 #pragma omp target teams distribute parallel for simd // OK
14201     for (int i = 0; i < 10; ++i)
14202       ;
14203   }
14204 #pragma omp taskloop
14205   for (int i = 0; i < 10; ++i) {
14206 #pragma omp target teams distribute simd // OK
14207     for (int i = 0; i < 10; ++i)
14208       ;
14209   }
14210 
14211 // DISTRIBUTE DIRECTIVE
14212 #pragma omp target
14213 #pragma omp teams
14214 #pragma omp distribute
14215   for (int i = 0; i < 10; ++i) {
14216 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
14217     for (int i = 0; i < 10; ++i)
14218       ;
14219   }
14220 #pragma omp target
14221 #pragma omp teams
14222 #pragma omp distribute
14223   for (int i = 0; i < 10; ++i) {
14224 #pragma omp for
14225     for (int i = 0; i < 10; ++i)
14226       ;
14227   }
14228 #pragma omp target
14229 #pragma omp teams
14230 #pragma omp distribute
14231   for (int i = 0; i < 10; ++i) {
14232 #pragma omp simd
14233     for (int i = 0; i < 10; ++i)
14234       ;
14235   }
14236 #pragma omp target
14237 #pragma omp teams
14238 #pragma omp distribute
14239   for (int i = 0; i < 10; ++i) {
14240 #pragma omp for simd
14241     for (int i = 0; i < 10; ++i)
14242       ;
14243   }
14244 #pragma omp target
14245 #pragma omp teams
14246 #pragma omp distribute
14247   for (int i = 0; i < 10; ++i) {
14248 #pragma omp parallel
14249     for (int i = 0; i < 10; ++i)
14250       ;
14251   }
14252 #pragma omp target
14253 #pragma omp teams
14254 #pragma omp distribute
14255   for (int i = 0; i < 10; ++i) {
14256 #pragma omp sections
14257     {
14258       bar();
14259     }
14260   }
14261 #pragma omp target
14262 #pragma omp teams
14263 #pragma omp distribute
14264   for (int i = 0; i < 10; ++i) {
14265 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute region}}
14266     {
14267       bar();
14268     }
14269   }
14270 #pragma omp target
14271 #pragma omp teams
14272 #pragma omp distribute
14273   for (int i = 0; i < 10; ++i) {
14274 #pragma omp single
14275     {
14276       bar();
14277     }
14278   }
14279 #pragma omp target
14280 #pragma omp teams
14281 #pragma omp distribute
14282   for (int i = 0; i < 10; ++i) {
14283 #pragma omp master
14284     {
14285       bar();
14286     }
14287   }
14288 #pragma omp target
14289 #pragma omp teams
14290 #pragma omp distribute
14291   for (int i = 0; i < 10; ++i) {
14292 #pragma omp critical
14293     {
14294       bar();
14295     }
14296   }
14297 #pragma omp target
14298 #pragma omp teams
14299 #pragma omp distribute
14300   for (int i = 0; i < 10; ++i) {
14301 #pragma omp parallel
14302     {
14303 #pragma omp single
14304       {
14305         bar();
14306       }
14307     }
14308   }
14309 #pragma omp target
14310 #pragma omp teams
14311 #pragma omp distribute
14312   for (int i = 0; i < 10; ++i) {
14313 #pragma omp parallel for
14314     for (int i = 0; i < 10; ++i)
14315       ;
14316   }
14317 #pragma omp target
14318 #pragma omp teams
14319 #pragma omp distribute
14320   for (int i = 0; i < 10; ++i) {
14321 #pragma omp parallel for simd
14322     for (int i = 0; i < 10; ++i)
14323       ;
14324   }
14325 #pragma omp target
14326 #pragma omp teams
14327 #pragma omp distribute
14328   for (int i = 0; i < 10; ++i) {
14329 #pragma omp parallel sections
14330     {
14331       bar();
14332     }
14333   }
14334 #pragma omp target
14335 #pragma omp teams
14336 #pragma omp distribute
14337   for (int i = 0; i < 10; ++i) {
14338 #pragma omp task
14339     {
14340       bar();
14341     }
14342   }
14343 #pragma omp target
14344 #pragma omp teams
14345 #pragma omp distribute
14346   for (int i = 0; i < 10; ++i) {
14347 #pragma omp taskyield
14348     bar();
14349   }
14350 #pragma omp target
14351 #pragma omp teams
14352 #pragma omp distribute
14353   for (int i = 0; i < 10; ++i) {
14354 #pragma omp barrier
14355     bar();
14356   }
14357 #pragma omp target
14358 #pragma omp teams
14359 #pragma omp distribute
14360   for (int i = 0; i < 10; ++i) {
14361 #pragma omp taskwait
14362     bar();
14363   }
14364 #pragma omp target
14365 #pragma omp teams
14366 #pragma omp distribute
14367   for (int i = 0; i < 10; ++i) {
14368 #pragma omp flush
14369     bar();
14370   }
14371 #pragma omp target
14372 #pragma omp teams
14373 #pragma omp distribute
14374   for (int i = 0; i < 10; ++i) {
14375 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
14376     bar();
14377   }
14378 #pragma omp target
14379 #pragma omp teams
14380 #pragma omp distribute
14381   for (int i = 0; i < 10; ++i) {
14382 #pragma omp atomic
14383     ++a;
14384   }
14385 #pragma omp target
14386 #pragma omp teams
14387 #pragma omp distribute
14388   for (int i = 0; i < 10; ++i) {
14389 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
14390     ++a;
14391   }
14392 #pragma omp target
14393 #pragma omp teams
14394 #pragma omp distribute
14395   for (int i = 0; i < 10; ++i) {
14396 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
14397     ++a;
14398   }
14399 #pragma omp target
14400 #pragma omp teams
14401 #pragma omp distribute
14402   for (int i = 0; i < 10; ++i) {
14403 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
14404     for (int i = 0; i < 10; ++i)
14405       ;
14406   }
14407 #pragma omp target
14408 #pragma omp teams
14409 #pragma omp distribute
14410   for (int i = 0; i < 10; ++i) {
14411 #pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
14412     ++a;
14413   }
14414 #pragma omp target
14415 #pragma omp teams
14416 #pragma omp distribute
14417   for (int i = 0; i < 10; ++i) {
14418 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
14419     ++a;
14420   }
14421 #pragma omp target
14422 #pragma omp teams
14423 #pragma omp distribute
14424   for (int i = 0; i < 10; ++i) {
14425 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
14426     ++a;
14427   }
14428 #pragma omp target
14429 #pragma omp teams
14430 #pragma omp distribute
14431   for (int i = 0; i < 10; ++i) {
14432 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
14433     ++a;
14434   }
14435 #pragma omp target
14436 #pragma omp teams
14437 #pragma omp distribute
14438   for (int i = 0; i < 10; ++i) {
14439 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
14440   for (int i = 0; i < 10; ++i)
14441     ++a;
14442   }
14443 #pragma omp target
14444 #pragma omp teams
14445 #pragma omp distribute
14446   for (int i = 0; i < 10; ++i) {
14447 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
14448   for (int i = 0; i < 10; ++i)
14449     ++a;
14450   }
14451 #pragma omp target
14452 #pragma omp teams
14453 #pragma omp distribute
14454   for (int i = 0; i < 10; ++i) {
14455 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
14456   for (int i = 0; i < 10; ++i)
14457     ++a;
14458   }
14459 #pragma omp target
14460 #pragma omp teams
14461 #pragma omp distribute
14462   for (int i = 0; i < 10; ++i) {
14463 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
14464   for (int i = 0; i < 10; ++i)
14465     ++a;
14466   }
14467 #pragma omp target
14468 #pragma omp teams
14469 #pragma omp distribute
14470   for (int i = 0; i < 10; ++i) {
14471 #pragma omp target parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
14472   for (int i = 0; i < 10; ++i)
14473     ++a;
14474   }
14475 #pragma omp target
14476 #pragma omp teams
14477 #pragma omp distribute
14478   for (int i = 0; i < 10; ++i) {
14479 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
14480   for (int i = 0; i < 10; ++i)
14481     ++a;
14482   }
14483 #pragma omp target
14484 #pragma omp teams
14485 #pragma omp distribute
14486   for (int i = 0; i < 10; ++i) {
14487 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
14488   for (int i = 0; i < 10; ++i)
14489     ++a;
14490   }
14491 #pragma omp target
14492 #pragma omp teams
14493 #pragma omp distribute
14494   for (int i = 0; i < 10; ++i) {
14495 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
14496   for (int i = 0; i < 10; ++i)
14497     ++a;
14498   }
14499 #pragma omp target
14500 #pragma omp teams
14501 #pragma omp distribute
14502   for (int i = 0; i < 10; ++i) {
14503 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
14504   for (int i = 0; i < 10; ++i)
14505     ++a;
14506   }
14507 #pragma omp target
14508 #pragma omp teams
14509 #pragma omp distribute
14510   for (int i = 0; i < 10; ++i) {
14511 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
14512   for (int i = 0; i < 10; ++i)
14513     ++a;
14514   }
14515 #pragma omp target
14516 #pragma omp teams
14517 #pragma omp distribute
14518   for (int i = 0; i < 10; ++i) {
14519 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
14520   for (int i = 0; i < 10; ++i)
14521     ++a;
14522   }
14523 
14524 // DISTRIBUTE PARALLEL FOR DIRECTIVE
14525 #pragma omp target
14526 #pragma omp teams
14527 #pragma omp distribute parallel for
14528   for (int i = 0; i < 10; ++i) {
14529 #pragma omp distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute parallel for' directive into a teams region?}}
14530     for (int i = 0; i < 10; ++i)
14531       ;
14532   }
14533 
14534 #pragma omp target
14535 #pragma omp teams
14536 #pragma omp distribute parallel for
14537   for (int i = 0; i < 10; ++i) {
14538 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
14539     for (int i = 0; i < 10; ++i)
14540       ;
14541   }
14542 #pragma omp target
14543 #pragma omp teams
14544 #pragma omp distribute parallel for
14545   for (int i = 0; i < 10; ++i) {
14546 #pragma omp for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
14547     for (int i = 0; i < 10; ++i)
14548       ;
14549   }
14550 #pragma omp target
14551 #pragma omp teams
14552 #pragma omp distribute parallel for
14553   for (int i = 0; i < 10; ++i) {
14554 #pragma omp simd
14555     for (int i = 0; i < 10; ++i)
14556       ;
14557   }
14558 #pragma omp target
14559 #pragma omp teams
14560 #pragma omp distribute parallel for
14561   for (int i = 0; i < 10; ++i) {
14562 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
14563     for (int i = 0; i < 10; ++i)
14564       ;
14565   }
14566 #pragma omp target
14567 #pragma omp teams
14568 #pragma omp distribute parallel for
14569   for (int i = 0; i < 10; ++i) {
14570 #pragma omp parallel
14571     for (int i = 0; i < 10; ++i)
14572       ;
14573   }
14574 #pragma omp target
14575 #pragma omp teams
14576 #pragma omp distribute parallel for
14577   for (int i = 0; i < 10; ++i) {
14578 #pragma omp sections // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
14579     {
14580       bar();
14581     }
14582   }
14583 #pragma omp target
14584 #pragma omp teams
14585 #pragma omp distribute parallel for
14586   for (int i = 0; i < 10; ++i) {
14587 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute parallel for region}}
14588     {
14589       bar();
14590     }
14591   }
14592 #pragma omp target
14593 #pragma omp teams
14594 #pragma omp distribute parallel for
14595   for (int i = 0; i < 10; ++i) {
14596 #pragma omp single // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
14597     {
14598       bar();
14599     }
14600   }
14601 #pragma omp target
14602 #pragma omp teams
14603 #pragma omp distribute parallel for
14604   for (int i = 0; i < 10; ++i) {
14605 #pragma omp master // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}}
14606     {
14607       bar();
14608     }
14609   }
14610 #pragma omp target
14611 #pragma omp teams
14612 #pragma omp distribute parallel for
14613   for (int i = 0; i < 10; ++i) {
14614 #pragma omp critical
14615     {
14616       bar();
14617     }
14618   }
14619 #pragma omp target
14620 #pragma omp teams
14621 #pragma omp distribute parallel for
14622   for (int i = 0; i < 10; ++i) {
14623 #pragma omp parallel
14624     {
14625 #pragma omp single
14626       {
14627         bar();
14628       }
14629     }
14630   }
14631 #pragma omp target
14632 #pragma omp teams
14633 #pragma omp distribute parallel for
14634   for (int i = 0; i < 10; ++i) {
14635 #pragma omp parallel for
14636     for (int i = 0; i < 10; ++i)
14637       ;
14638   }
14639 #pragma omp target
14640 #pragma omp teams
14641 #pragma omp distribute parallel for
14642   for (int i = 0; i < 10; ++i) {
14643 #pragma omp parallel for simd
14644     for (int i = 0; i < 10; ++i)
14645       ;
14646   }
14647 #pragma omp target
14648 #pragma omp teams
14649 #pragma omp distribute parallel for
14650   for (int i = 0; i < 10; ++i) {
14651 #pragma omp parallel sections
14652     {
14653       bar();
14654     }
14655   }
14656 #pragma omp target
14657 #pragma omp teams
14658 #pragma omp distribute parallel for
14659   for (int i = 0; i < 10; ++i) {
14660 #pragma omp task
14661     {
14662       bar();
14663     }
14664   }
14665 #pragma omp target
14666 #pragma omp teams
14667 #pragma omp distribute parallel for
14668   for (int i = 0; i < 10; ++i) {
14669 #pragma omp taskyield
14670     bar();
14671   }
14672 #pragma omp target
14673 #pragma omp teams
14674 #pragma omp distribute parallel for
14675   for (int i = 0; i < 10; ++i) {
14676 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}}
14677     bar();
14678   }
14679 #pragma omp target
14680 #pragma omp teams
14681 #pragma omp distribute parallel for
14682   for (int i = 0; i < 10; ++i) {
14683 #pragma omp taskwait
14684     bar();
14685   }
14686 #pragma omp target
14687 #pragma omp teams
14688 #pragma omp distribute parallel for
14689   for (int i = 0; i < 10; ++i) {
14690 #pragma omp flush
14691     bar();
14692   }
14693 #pragma omp target
14694 #pragma omp teams
14695 #pragma omp distribute parallel for
14696   for (int i = 0; i < 10; ++i) {
14697 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
14698     bar();
14699   }
14700 #pragma omp target
14701 #pragma omp teams
14702 #pragma omp distribute parallel for
14703   for (int i = 0; i < 10; ++i) {
14704 #pragma omp atomic
14705     ++a;
14706   }
14707 #pragma omp target
14708 #pragma omp teams
14709 #pragma omp distribute parallel for
14710   for (int i = 0; i < 10; ++i) {
14711 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
14712     ++a;
14713   }
14714 #pragma omp target
14715 #pragma omp teams
14716 #pragma omp distribute parallel for
14717   for (int i = 0; i < 10; ++i) {
14718 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
14719     ++a;
14720   }
14721 #pragma omp target
14722 #pragma omp teams
14723 #pragma omp distribute parallel for
14724   for (int i = 0; i < 10; ++i) {
14725 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
14726     for (int i = 0; i < 10; ++i)
14727       ;
14728   }
14729 #pragma omp target
14730 #pragma omp teams
14731 #pragma omp distribute parallel for
14732   for (int i = 0; i < 10; ++i) {
14733 #pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
14734     ++a;
14735   }
14736 #pragma omp target
14737 #pragma omp teams
14738 #pragma omp distribute parallel for
14739   for (int i = 0; i < 10; ++i) {
14740 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
14741     ++a;
14742   }
14743 #pragma omp target
14744 #pragma omp teams
14745 #pragma omp distribute parallel for
14746   for (int i = 0; i < 10; ++i) {
14747 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
14748     ++a;
14749   }
14750 #pragma omp target
14751 #pragma omp teams
14752 #pragma omp distribute parallel for
14753   for (int i = 0; i < 10; ++i) {
14754 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
14755     ++a;
14756   }
14757 #pragma omp target
14758 #pragma omp teams
14759 #pragma omp distribute parallel for
14760   for (int i = 0; i < 10; ++i) {
14761 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
14762   for (int i = 0; i < 10; ++i)
14763     ++a;
14764   }
14765 #pragma omp target
14766 #pragma omp teams
14767 #pragma omp distribute parallel for
14768   for (int i = 0; i < 10; ++i) {
14769 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
14770   for (int i = 0; i < 10; ++i)
14771     ++a;
14772   }
14773 #pragma omp target
14774 #pragma omp teams
14775 #pragma omp distribute parallel for
14776   for (int i = 0; i < 10; ++i) {
14777 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
14778   for (int i = 0; i < 10; ++i)
14779     ++a;
14780   }
14781 #pragma omp target
14782 #pragma omp teams
14783 #pragma omp distribute parallel for
14784   for (int i = 0; i < 10; ++i) {
14785 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
14786   for (int i = 0; i < 10; ++i)
14787     ++a;
14788   }
14789 #pragma omp target
14790 #pragma omp teams
14791 #pragma omp distribute parallel for
14792   for (int i = 0; i < 10; ++i) {
14793 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
14794   for (int i = 0; i < 10; ++i)
14795     ++a;
14796   }
14797 #pragma omp target
14798 #pragma omp teams
14799 #pragma omp distribute parallel for
14800   for (int i = 0; i < 10; ++i) {
14801 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
14802   for (int i = 0; i < 10; ++i)
14803     ++a;
14804   }
14805 #pragma omp target
14806 #pragma omp teams
14807 #pragma omp distribute parallel for
14808   for (int i = 0; i < 10; ++i) {
14809 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
14810     ++a;
14811   }
14812 #pragma omp target
14813 #pragma omp teams
14814 #pragma omp distribute parallel for
14815   for (int i = 0; i < 10; ++i) {
14816 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
14817   for (int i = 0; i < 10; ++i)
14818     ++a;
14819   }
14820 #pragma omp target
14821 #pragma omp teams
14822 #pragma omp distribute parallel for
14823   for (int i = 0; i < 10; ++i) {
14824 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
14825   for (int i = 0; i < 10; ++i)
14826     ++a;
14827   }
14828 #pragma omp target
14829 #pragma omp teams
14830 #pragma omp distribute parallel for
14831   for (int i = 0; i < 10; ++i) {
14832 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
14833   for (int i = 0; i < 10; ++i)
14834     ++a;
14835   }
14836 #pragma omp target
14837 #pragma omp teams
14838 #pragma omp distribute parallel for
14839   for (int i = 0; i < 10; ++i) {
14840 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
14841   for (int i = 0; i < 10; ++i)
14842     ++a;
14843   }
14844 
14845 // DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
14846 #pragma omp target
14847 #pragma omp teams
14848 #pragma omp distribute parallel for simd
14849   for (int i = 0; i < 10; ++i) {
14850 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14851     for (int i = 0; i < 10; ++i)
14852       ;
14853   }
14854 #pragma omp target
14855 #pragma omp teams
14856 #pragma omp distribute parallel for simd
14857   for (int i = 0; i < 10; ++i) {
14858 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14859     for (int i = 0; i < 10; ++i)
14860       ;
14861   }
14862 #pragma omp target
14863 #pragma omp teams
14864 #pragma omp distribute parallel for simd
14865   for (int i = 0; i < 10; ++i) {
14866 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14867     for (int i = 0; i < 10; ++i)
14868       ;
14869   }
14870 #pragma omp target
14871 #pragma omp teams
14872 #pragma omp distribute parallel for simd
14873   for (int i = 0; i < 10; ++i) {
14874 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
14875     for (int i = 0; i < 10; ++i)
14876       ;
14877   }
14878 #pragma omp target
14879 #pragma omp teams
14880 #pragma omp distribute parallel for simd
14881   for (int i = 0; i < 10; ++i) {
14882 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14883     for (int i = 0; i < 10; ++i)
14884       ;
14885   }
14886 #pragma omp target
14887 #pragma omp teams
14888 #pragma omp distribute parallel for simd
14889   for (int i = 0; i < 10; ++i) {
14890 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14891     for (int i = 0; i < 10; ++i)
14892       ;
14893   }
14894 #pragma omp target
14895 #pragma omp teams
14896 #pragma omp distribute parallel for simd
14897   for (int i = 0; i < 10; ++i) {
14898 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14899     {
14900       bar();
14901     }
14902   }
14903 #pragma omp target
14904 #pragma omp teams
14905 #pragma omp distribute parallel for simd
14906   for (int i = 0; i < 10; ++i) {
14907 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14908     {
14909       bar();
14910     }
14911   }
14912 #pragma omp target
14913 #pragma omp teams
14914 #pragma omp distribute parallel for simd
14915   for (int i = 0; i < 10; ++i) {
14916 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14917     {
14918       bar();
14919     }
14920   }
14921 #pragma omp target
14922 #pragma omp teams
14923 #pragma omp distribute parallel for simd
14924   for (int i = 0; i < 10; ++i) {
14925 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14926     {
14927       bar();
14928     }
14929   }
14930 #pragma omp target
14931 #pragma omp teams
14932 #pragma omp distribute parallel for simd
14933   for (int i = 0; i < 10; ++i) {
14934 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14935     {
14936       bar();
14937     }
14938   }
14939 #pragma omp target
14940 #pragma omp teams
14941 #pragma omp distribute parallel for simd
14942   for (int i = 0; i < 10; ++i) {
14943 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14944     {
14945 #pragma omp single
14946       {
14947         bar();
14948       }
14949     }
14950   }
14951 #pragma omp target
14952 #pragma omp teams
14953 #pragma omp distribute parallel for simd
14954   for (int i = 0; i < 10; ++i) {
14955 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14956     for (int i = 0; i < 10; ++i)
14957       ;
14958   }
14959 #pragma omp target
14960 #pragma omp teams
14961 #pragma omp distribute parallel for simd
14962   for (int i = 0; i < 10; ++i) {
14963 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14964     for (int i = 0; i < 10; ++i)
14965       ;
14966   }
14967 #pragma omp target
14968 #pragma omp teams
14969 #pragma omp distribute parallel for simd
14970   for (int i = 0; i < 10; ++i) {
14971 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14972     {
14973       bar();
14974     }
14975   }
14976 #pragma omp target
14977 #pragma omp teams
14978 #pragma omp distribute parallel for simd
14979   for (int i = 0; i < 10; ++i) {
14980 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14981     {
14982       bar();
14983     }
14984   }
14985 #pragma omp target
14986 #pragma omp teams
14987 #pragma omp distribute parallel for simd
14988   for (int i = 0; i < 10; ++i) {
14989 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14990     bar();
14991   }
14992 #pragma omp target
14993 #pragma omp teams
14994 #pragma omp distribute parallel for simd
14995   for (int i = 0; i < 10; ++i) {
14996 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14997     bar();
14998   }
14999 #pragma omp target
15000 #pragma omp teams
15001 #pragma omp distribute parallel for simd
15002   for (int i = 0; i < 10; ++i) {
15003 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15004     bar();
15005   }
15006 #pragma omp target
15007 #pragma omp teams
15008 #pragma omp distribute parallel for simd
15009   for (int i = 0; i < 10; ++i) {
15010 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15011     bar();
15012   }
15013 #pragma omp target
15014 #pragma omp teams
15015 #pragma omp distribute parallel for simd
15016   for (int i = 0; i < 10; ++i) {
15017 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15018     bar();
15019   }
15020 #pragma omp target
15021 #pragma omp teams
15022 #pragma omp distribute parallel for simd
15023   for (int i = 0; i < 10; ++i) {
15024 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
15025     ++a;
15026   }
15027 #pragma omp target
15028 #pragma omp teams
15029 #pragma omp distribute parallel for simd
15030   for (int i = 0; i < 10; ++i) {
15031 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15032     ++a;
15033   }
15034 #pragma omp target
15035 #pragma omp teams
15036 #pragma omp distribute parallel for simd
15037   for (int i = 0; i < 10; ++i) {
15038 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15039     ++a;
15040   }
15041 #pragma omp target
15042 #pragma omp teams
15043 #pragma omp distribute parallel for simd
15044   for (int i = 0; i < 10; ++i) {
15045 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15046     ++a;
15047   }
15048 #pragma omp target
15049 #pragma omp teams
15050 #pragma omp distribute parallel for simd
15051   for (int i = 0; i < 10; ++i) {
15052 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15053     ++a;
15054   }
15055 #pragma omp target
15056 #pragma omp teams
15057 #pragma omp distribute parallel for simd
15058   for (int i = 0; i < 10; ++i) {
15059 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15060     ++a;
15061   }
15062 #pragma omp target
15063 #pragma omp teams
15064 #pragma omp distribute parallel for simd
15065   for (int i = 0; i < 10; ++i) {
15066 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15067     ++a;
15068   }
15069 #pragma omp target
15070 #pragma omp teams
15071 #pragma omp distribute parallel for simd
15072   for (int i = 0; i < 10; ++i) {
15073 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15074     for (int i = 0; i < 10; ++i)
15075       ;
15076   }
15077 #pragma omp target
15078 #pragma omp teams
15079 #pragma omp distribute parallel for simd
15080   for (int i = 0; i < 10; ++i) {
15081 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15082     for (int i = 0; i < 10; ++i)
15083       ;
15084   }
15085 #pragma omp target
15086 #pragma omp teams
15087 #pragma omp distribute parallel for simd
15088   for (int i = 0; i < 10; ++i) {
15089 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15090     for (int i = 0; i < 10; ++i)
15091       ;
15092   }
15093 #pragma omp target
15094 #pragma omp teams
15095 #pragma omp distribute parallel for simd
15096   for (int i = 0; i < 10; ++i) {
15097 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15098     for (int i = 0; i < 10; ++i)
15099       ;
15100   }
15101 #pragma omp target
15102 #pragma omp teams
15103 #pragma omp distribute parallel for simd
15104   for (int i = 0; i < 10; ++i) {
15105 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15106     for (int i = 0; i < 10; ++i)
15107       ;
15108   }
15109 #pragma omp target
15110 #pragma omp teams
15111 #pragma omp distribute parallel for simd
15112   for (int i = 0; i < 10; ++i) {
15113 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15114     for (int i = 0; i < 10; ++i)
15115       ;
15116   }
15117 #pragma omp target
15118 #pragma omp teams
15119 #pragma omp distribute parallel for simd
15120   for (int i = 0; i < 10; ++i) {
15121 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15122     a++;
15123   }
15124 #pragma omp target
15125 #pragma omp teams
15126 #pragma omp distribute parallel for simd
15127   for (int i = 0; i < 10; ++i) {
15128 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15129     for (int i = 0; i < 10; ++i)
15130       ;
15131   }
15132 #pragma omp target
15133 #pragma omp teams
15134 #pragma omp distribute parallel for simd
15135   for (int i = 0; i < 10; ++i) {
15136 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15137     for (int i = 0; i < 10; ++i)
15138       ;
15139   }
15140 #pragma omp target
15141 #pragma omp teams
15142 #pragma omp distribute parallel for simd
15143   for (int i = 0; i < 10; ++i) {
15144 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15145     for (int i = 0; i < 10; ++i)
15146       ;
15147   }
15148 #pragma omp target
15149 #pragma omp teams
15150 #pragma omp distribute parallel for simd
15151   for (int i = 0; i < 10; ++i) {
15152 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15153     for (int i = 0; i < 10; ++i)
15154       ;
15155   }
15156 
15157 // DISTRIBUTE SIMD DIRECTIVE
15158 #pragma omp target
15159 #pragma omp teams
15160 #pragma omp distribute simd
15161   for (int i = 0; i < 10; ++i) {
15162 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15163     for (int i = 0; i < 10; ++i)
15164       ;
15165   }
15166 #pragma omp target
15167 #pragma omp teams
15168 #pragma omp distribute simd
15169   for (int i = 0; i < 10; ++i) {
15170 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15171     for (int i = 0; i < 10; ++i)
15172       ;
15173   }
15174 #pragma omp target
15175 #pragma omp teams
15176 #pragma omp distribute simd
15177   for (int i = 0; i < 10; ++i) {
15178 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15179     for (int i = 0; i < 10; ++i)
15180       ;
15181   }
15182 #pragma omp target
15183 #pragma omp teams
15184 #pragma omp distribute simd
15185   for (int i = 0; i < 10; ++i) {
15186 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
15187     for (int i = 0; i < 10; ++i)
15188       ;
15189   }
15190 #pragma omp target
15191 #pragma omp teams
15192 #pragma omp distribute simd
15193   for (int i = 0; i < 10; ++i) {
15194 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15195     for (int i = 0; i < 10; ++i)
15196       ;
15197   }
15198 #pragma omp target
15199 #pragma omp teams
15200 #pragma omp distribute simd
15201   for (int i = 0; i < 10; ++i) {
15202 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15203     for (int i = 0; i < 10; ++i)
15204       ;
15205   }
15206 #pragma omp target
15207 #pragma omp teams
15208 #pragma omp distribute simd
15209   for (int i = 0; i < 10; ++i) {
15210 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15211     {
15212       bar();
15213     }
15214   }
15215 #pragma omp target
15216 #pragma omp teams
15217 #pragma omp distribute simd
15218   for (int i = 0; i < 10; ++i) {
15219 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15220     {
15221       bar();
15222     }
15223   }
15224 #pragma omp target
15225 #pragma omp teams
15226 #pragma omp distribute simd
15227   for (int i = 0; i < 10; ++i) {
15228 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15229     {
15230       bar();
15231     }
15232   }
15233 #pragma omp target
15234 #pragma omp teams
15235 #pragma omp distribute simd
15236   for (int i = 0; i < 10; ++i) {
15237 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15238     {
15239       bar();
15240     }
15241   }
15242 #pragma omp target
15243 #pragma omp teams
15244 #pragma omp distribute simd
15245   for (int i = 0; i < 10; ++i) {
15246 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15247     {
15248       bar();
15249     }
15250   }
15251 #pragma omp target
15252 #pragma omp teams
15253 #pragma omp distribute simd
15254   for (int i = 0; i < 10; ++i) {
15255 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15256     {
15257 #pragma omp single
15258       {
15259         bar();
15260       }
15261     }
15262   }
15263 #pragma omp target
15264 #pragma omp teams
15265 #pragma omp distribute simd
15266   for (int i = 0; i < 10; ++i) {
15267 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15268     for (int i = 0; i < 10; ++i)
15269       ;
15270   }
15271 #pragma omp target
15272 #pragma omp teams
15273 #pragma omp distribute simd
15274   for (int i = 0; i < 10; ++i) {
15275 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15276     for (int i = 0; i < 10; ++i)
15277       ;
15278   }
15279 #pragma omp target
15280 #pragma omp teams
15281 #pragma omp distribute simd
15282   for (int i = 0; i < 10; ++i) {
15283 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15284     {
15285       bar();
15286     }
15287   }
15288 #pragma omp target
15289 #pragma omp teams
15290 #pragma omp distribute simd
15291   for (int i = 0; i < 10; ++i) {
15292 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15293     {
15294       bar();
15295     }
15296   }
15297 #pragma omp target
15298 #pragma omp teams
15299 #pragma omp distribute simd
15300   for (int i = 0; i < 10; ++i) {
15301 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15302     bar();
15303   }
15304 #pragma omp target
15305 #pragma omp teams
15306 #pragma omp distribute simd
15307   for (int i = 0; i < 10; ++i) {
15308 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15309     bar();
15310   }
15311 #pragma omp target
15312 #pragma omp teams
15313 #pragma omp distribute simd
15314   for (int i = 0; i < 10; ++i) {
15315 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15316     bar();
15317   }
15318 #pragma omp target
15319 #pragma omp teams
15320 #pragma omp distribute simd
15321   for (int i = 0; i < 10; ++i) {
15322 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15323     bar();
15324   }
15325 #pragma omp target
15326 #pragma omp teams
15327 #pragma omp distribute simd
15328   for (int i = 0; i < 10; ++i) {
15329 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15330     bar();
15331   }
15332 #pragma omp target
15333 #pragma omp teams
15334 #pragma omp distribute simd
15335   for (int i = 0; i < 10; ++i) {
15336 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
15337     ++a;
15338   }
15339 #pragma omp target
15340 #pragma omp teams
15341 #pragma omp distribute simd
15342   for (int i = 0; i < 10; ++i) {
15343 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15344     ++a;
15345   }
15346 #pragma omp target
15347 #pragma omp teams
15348 #pragma omp distribute simd
15349   for (int i = 0; i < 10; ++i) {
15350 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15351     ++a;
15352   }
15353 #pragma omp target
15354 #pragma omp teams
15355 #pragma omp distribute simd
15356   for (int i = 0; i < 10; ++i) {
15357 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15358     ++a;
15359   }
15360 #pragma omp target
15361 #pragma omp teams
15362 #pragma omp distribute simd
15363   for (int i = 0; i < 10; ++i) {
15364 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15365     ++a;
15366   }
15367 #pragma omp target
15368 #pragma omp teams
15369 #pragma omp distribute simd
15370   for (int i = 0; i < 10; ++i) {
15371 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15372     ++a;
15373   }
15374 #pragma omp target
15375 #pragma omp teams
15376 #pragma omp distribute simd
15377   for (int i = 0; i < 10; ++i) {
15378 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15379     ++a;
15380   }
15381 #pragma omp target
15382 #pragma omp teams
15383 #pragma omp distribute simd
15384   for (int i = 0; i < 10; ++i) {
15385 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15386     for (int i = 0; i < 10; ++i)
15387       ;
15388   }
15389 #pragma omp target
15390 #pragma omp teams
15391 #pragma omp distribute simd
15392   for (int i = 0; i < 10; ++i) {
15393 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15394     for (int i = 0; i < 10; ++i)
15395       ;
15396   }
15397 #pragma omp target
15398 #pragma omp teams
15399 #pragma omp distribute simd
15400   for (int i = 0; i < 10; ++i) {
15401 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15402     for (int i = 0; i < 10; ++i)
15403       ;
15404   }
15405 #pragma omp target
15406 #pragma omp teams
15407 #pragma omp distribute simd
15408   for (int i = 0; i < 10; ++i) {
15409 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15410     for (int i = 0; i < 10; ++i)
15411       ;
15412   }
15413 #pragma omp target
15414 #pragma omp teams
15415 #pragma omp distribute simd
15416   for (int i = 0; i < 10; ++i) {
15417 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15418     for (int i = 0; i < 10; ++i)
15419       ;
15420   }
15421 #pragma omp target
15422 #pragma omp teams
15423 #pragma omp distribute simd
15424   for (int i = 0; i < 10; ++i) {
15425 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15426     for (int i = 0; i < 10; ++i)
15427       ;
15428   }
15429 #pragma omp target
15430 #pragma omp teams
15431 #pragma omp distribute simd
15432   for (int i = 0; i < 10; ++i) {
15433 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15434     a++;
15435   }
15436 #pragma omp target
15437 #pragma omp teams
15438 #pragma omp distribute simd
15439   for (int i = 0; i < 10; ++i) {
15440 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15441     for (int i = 0; i < 10; ++i)
15442       ;
15443   }
15444 #pragma omp target
15445 #pragma omp teams
15446 #pragma omp distribute simd
15447   for (int i = 0; i < 10; ++i) {
15448 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15449     for (int i = 0; i < 10; ++i)
15450       ;
15451   }
15452 #pragma omp target
15453 #pragma omp teams
15454 #pragma omp distribute simd
15455   for (int i = 0; i < 10; ++i) {
15456 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15457     for (int i = 0; i < 10; ++i)
15458       ;
15459   }
15460 #pragma omp target
15461 #pragma omp teams
15462 #pragma omp distribute simd
15463   for (int i = 0; i < 10; ++i) {
15464 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15465     for (int i = 0; i < 10; ++i)
15466       ;
15467   }
15468 
15469 // TARGET SIMD DIRECTIVE
15470 #pragma omp target simd
15471   for (int i = 0; i < 10; ++i) {
15472 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15473     for (int i = 0; i < 10; ++i)
15474       ;
15475   }
15476 #pragma omp target simd
15477   for (int i = 0; i < 10; ++i) {
15478 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15479     for (int i = 0; i < 10; ++i)
15480       ;
15481   }
15482 #pragma omp target simd
15483   for (int i = 0; i < 10; ++i) {
15484 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15485     for (int i = 0; i < 10; ++i)
15486       ;
15487   }
15488 #pragma omp target simd
15489   for (int i = 0; i < 10; ++i) {
15490 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
15491     for (int i = 0; i < 10; ++i)
15492       ;
15493   }
15494 #pragma omp target simd
15495   for (int i = 0; i < 10; ++i) {
15496 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15497     for (int i = 0; i < 10; ++i)
15498       ;
15499   }
15500 #pragma omp target simd
15501   for (int i = 0; i < 10; ++i) {
15502 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15503     for (int i = 0; i < 10; ++i)
15504       ;
15505   }
15506 #pragma omp target simd
15507   for (int i = 0; i < 10; ++i) {
15508 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15509     {
15510       bar();
15511     }
15512   }
15513 #pragma omp target simd
15514   for (int i = 0; i < 10; ++i) {
15515 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15516     {
15517       bar();
15518     }
15519   }
15520 #pragma omp target simd
15521   for (int i = 0; i < 10; ++i) {
15522 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15523     {
15524       bar();
15525     }
15526   }
15527 #pragma omp target simd
15528   for (int i = 0; i < 10; ++i) {
15529 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15530     {
15531       bar();
15532     }
15533   }
15534 #pragma omp target simd
15535   for (int i = 0; i < 10; ++i) {
15536 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15537     {
15538       bar();
15539     }
15540   }
15541 #pragma omp target simd
15542   for (int i = 0; i < 10; ++i) {
15543 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15544     {
15545 #pragma omp single
15546       {
15547         bar();
15548       }
15549     }
15550   }
15551 #pragma omp target simd
15552   for (int i = 0; i < 10; ++i) {
15553 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15554     for (int i = 0; i < 10; ++i)
15555       ;
15556   }
15557 #pragma omp target simd
15558   for (int i = 0; i < 10; ++i) {
15559 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15560     for (int i = 0; i < 10; ++i)
15561       ;
15562   }
15563 #pragma omp target simd
15564   for (int i = 0; i < 10; ++i) {
15565 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15566     {
15567       bar();
15568     }
15569   }
15570 #pragma omp target simd
15571   for (int i = 0; i < 10; ++i) {
15572 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15573     {
15574       bar();
15575     }
15576   }
15577 #pragma omp target simd
15578   for (int i = 0; i < 10; ++i) {
15579 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15580     bar();
15581   }
15582 #pragma omp target simd
15583   for (int i = 0; i < 10; ++i) {
15584 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15585     bar();
15586   }
15587 #pragma omp target simd
15588   for (int i = 0; i < 10; ++i) {
15589 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15590     bar();
15591   }
15592 #pragma omp target simd
15593   for (int i = 0; i < 10; ++i) {
15594 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15595     bar();
15596   }
15597 #pragma omp target simd
15598   for (int i = 0; i < 10; ++i) {
15599 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15600     bar();
15601   }
15602 #pragma omp target simd
15603   for (int i = 0; i < 10; ++i) {
15604 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
15605     ++a;
15606   }
15607 #pragma omp target simd
15608   for (int i = 0; i < 10; ++i) {
15609 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15610     ++a;
15611   }
15612 #pragma omp target simd
15613   for (int i = 0; i < 10; ++i) {
15614 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15615     ++a;
15616   }
15617 #pragma omp target simd
15618   for (int i = 0; i < 10; ++i) {
15619 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15620     ++a;
15621   }
15622 #pragma omp target simd
15623   for (int i = 0; i < 10; ++i) {
15624 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15625     ++a;
15626   }
15627 #pragma omp target simd
15628   for (int i = 0; i < 10; ++i) {
15629 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15630     ++a;
15631   }
15632 #pragma omp target simd
15633   for (int i = 0; i < 10; ++i) {
15634 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15635     ++a;
15636   }
15637 #pragma omp target simd
15638   for (int i = 0; i < 10; ++i) {
15639 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15640     for (int i = 0; i < 10; ++i)
15641       ;
15642   }
15643 #pragma omp target simd
15644   for (int i = 0; i < 10; ++i) {
15645 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15646     for (int i = 0; i < 10; ++i)
15647       ;
15648   }
15649 #pragma omp target simd
15650   for (int i = 0; i < 10; ++i) {
15651 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15652     for (int i = 0; i < 10; ++i)
15653       ;
15654   }
15655 #pragma omp target simd
15656   for (int i = 0; i < 10; ++i) {
15657 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15658     for (int i = 0; i < 10; ++i)
15659       ;
15660   }
15661 #pragma omp target simd
15662   for (int i = 0; i < 10; ++i) {
15663 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15664     for (int i = 0; i < 10; ++i)
15665       ;
15666   }
15667 #pragma omp target simd
15668   for (int i = 0; i < 10; ++i) {
15669 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15670     for (int i = 0; i < 10; ++i)
15671       ;
15672   }
15673 #pragma omp target simd
15674   for (int i = 0; i < 10; ++i) {
15675 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15676     a++;
15677   }
15678 #pragma omp target simd
15679   for (int i = 0; i < 10; ++i) {
15680 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15681     for (int i = 0; i < 10; ++i)
15682       ;
15683   }
15684 #pragma omp target simd
15685   for (int i = 0; i < 10; ++i) {
15686 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15687     for (int i = 0; i < 10; ++i)
15688       ;
15689   }
15690 #pragma omp target simd
15691   for (int i = 0; i < 10; ++i) {
15692 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15693     for (int i = 0; i < 10; ++i)
15694       ;
15695   }
15696 #pragma omp target simd
15697   for (int i = 0; i < 10; ++i) {
15698 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15699     for (int i = 0; i < 10; ++i)
15700       ;
15701   }
15702 
15703 // TEAMS DISTRIBUTE DIRECTIVE
15704 #pragma omp teams distribute // omp45-error {{orphaned 'omp teams distribute' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
15705   for (int i = 0; i < 10; ++i)
15706     ;
15707 #pragma omp target
15708 #pragma omp teams distribute
15709   for (int i = 0; i < 10; ++i) {
15710 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
15711     for (int i = 0; i < 10; ++i)
15712       ;
15713   }
15714 #pragma omp target
15715 #pragma omp teams distribute
15716   for (int i = 0; i < 10; ++i) {
15717 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
15718     for (int i = 0; i < 10; ++i)
15719       ;
15720   }
15721 #pragma omp target
15722 #pragma omp teams distribute
15723   for (int i = 0; i < 10; ++i) {
15724 #pragma omp for // OK
15725     for (int i = 0; i < 10; ++i)
15726       ;
15727   }
15728 #pragma omp target
15729 #pragma omp teams distribute
15730   for (int i = 0; i < 10; ++i) {
15731 #pragma omp simd // OK
15732     for (int i = 0; i < 10; ++i)
15733       ;
15734   }
15735 #pragma omp target
15736 #pragma omp teams distribute
15737   for (int i = 0; i < 10; ++i) {
15738 #pragma omp for simd // OK
15739     for (int i = 0; i < 10; ++i)
15740       ;
15741   }
15742 #pragma omp target
15743 #pragma omp teams distribute
15744   for (int i = 0; i < 10; ++i) {
15745 #pragma omp parallel // OK
15746     for (int i = 0; i < 10; ++i)
15747       ;
15748   }
15749 #pragma omp target
15750 #pragma omp teams distribute
15751   for (int i = 0; i < 10; ++i) {
15752 #pragma omp sections // OK
15753     {
15754       bar();
15755     }
15756   }
15757 #pragma omp target
15758 #pragma omp teams distribute
15759   for (int i = 0; i < 10; ++i) {
15760 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute region}}
15761     {
15762       bar();
15763     }
15764   }
15765 #pragma omp target
15766 #pragma omp teams distribute
15767   for (int i = 0; i < 10; ++i) {
15768 #pragma omp single // OK
15769     {
15770       bar();
15771     }
15772   }
15773 #pragma omp target
15774 #pragma omp teams distribute
15775   for (int i = 0; i < 10; ++i) {
15776 #pragma omp master // OK
15777     {
15778       bar();
15779     }
15780   }
15781 #pragma omp target
15782 #pragma omp teams distribute
15783   for (int i = 0; i < 10; ++i) {
15784 #pragma omp critical // OK
15785     {
15786       bar();
15787     }
15788   }
15789 #pragma omp target
15790 #pragma omp teams distribute
15791   for (int i = 0; i < 10; ++i) {
15792 #pragma omp parallel // OK
15793     {
15794 #pragma omp single
15795       {
15796         bar();
15797       }
15798     }
15799   }
15800 #pragma omp target
15801 #pragma omp teams distribute
15802   for (int i = 0; i < 10; ++i) {
15803 #pragma omp parallel for // OK
15804     for (int i = 0; i < 10; ++i)
15805       ;
15806   }
15807 #pragma omp target
15808 #pragma omp teams distribute
15809   for (int i = 0; i < 10; ++i) {
15810 #pragma omp parallel for simd // OK
15811     for (int i = 0; i < 10; ++i)
15812       ;
15813   }
15814 #pragma omp target
15815 #pragma omp teams distribute
15816   for (int i = 0; i < 10; ++i) {
15817 #pragma omp parallel sections // OK
15818     {
15819       bar();
15820     }
15821   }
15822 #pragma omp target
15823 #pragma omp teams distribute
15824   for (int i = 0; i < 10; ++i) {
15825 #pragma omp task // OK
15826     {
15827       bar();
15828     }
15829   }
15830 #pragma omp target
15831 #pragma omp teams distribute
15832   for (int i = 0; i < 10; ++i) {
15833 #pragma omp taskyield // OK
15834     bar();
15835   }
15836 #pragma omp target
15837 #pragma omp teams distribute
15838   for (int i = 0; i < 10; ++i) {
15839 #pragma omp barrier // OK
15840     bar();
15841   }
15842 #pragma omp target
15843 #pragma omp teams distribute
15844   for (int i = 0; i < 10; ++i) {
15845 #pragma omp taskwait // OK
15846     bar();
15847   }
15848 #pragma omp target
15849 #pragma omp teams distribute
15850   for (int i = 0; i < 10; ++i) {
15851 #pragma omp flush // OK
15852     bar();
15853   }
15854 #pragma omp target
15855 #pragma omp teams distribute
15856   for (int i = 0; i < 10; ++i) {
15857 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
15858     bar();
15859   }
15860 #pragma omp target
15861 #pragma omp teams distribute
15862   for (int i = 0; i < 10; ++i) {
15863 #pragma omp atomic // OK
15864     ++a;
15865   }
15866 #pragma omp target
15867 #pragma omp teams distribute
15868   for (int i = 0; i < 10; ++i) {
15869 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
15870     ++a;
15871   }
15872 #pragma omp target
15873 #pragma omp teams distribute
15874   for (int i = 0; i < 10; ++i) {
15875 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
15876     ++a;
15877   }
15878 #pragma omp target
15879 #pragma omp teams distribute
15880   for (int i = 0; i < 10; ++i) {
15881 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
15882     for (int i = 0; i < 10; ++i)
15883       ;
15884   }
15885 #pragma omp target
15886 #pragma omp teams distribute
15887   for (int i = 0; i < 10; ++i) {
15888 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
15889     ++a;
15890   }
15891 #pragma omp target
15892 #pragma omp teams distribute
15893   for (int i = 0; i < 10; ++i) {
15894 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
15895     ++a;
15896   }
15897 #pragma omp target
15898 #pragma omp teams distribute
15899   for (int i = 0; i < 10; ++i) {
15900 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
15901     ++a;
15902   }
15903 #pragma omp target
15904 #pragma omp teams distribute
15905   for (int i = 0; i < 10; ++i) {
15906 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
15907     ++a;
15908   }
15909 #pragma omp target
15910 #pragma omp teams distribute
15911   for (int i = 0; i < 10; ++i) {
15912 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
15913     for (int i = 0; i < 10; ++i)
15914       ++a;
15915   }
15916 #pragma omp target
15917 #pragma omp teams distribute
15918   for (int i = 0; i < 10; ++i) {
15919 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
15920     for (int i = 0; i < 10; ++i)
15921       ++a;
15922   }
15923 #pragma omp target
15924 #pragma omp teams distribute
15925   for (int i = 0; i < 10; ++i) {
15926 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
15927     for (int i = 0; i < 10; ++i)
15928       ++a;
15929   }
15930 #pragma omp target
15931 #pragma omp teams distribute
15932   for (int i = 0; i < 10; ++i) {
15933 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
15934     for (int i = 0; i < 10; ++i)
15935       ++a;
15936   }
15937 #pragma omp target
15938 #pragma omp teams distribute
15939   for (int i = 0; i < 10; ++i) {
15940 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
15941     for (int i = 0; i < 10; ++i)
15942       ++a;
15943   }
15944 #pragma omp target
15945 #pragma omp teams distribute
15946   for (int i = 0; i < 10; ++i) {
15947 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
15948     for (int i = 0; i < 10; ++i)
15949       ++a;
15950   }
15951 #pragma omp target
15952 #pragma omp teams distribute
15953   for (int i = 0; i < 10; ++i) {
15954 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
15955     ++a;
15956   }
15957 #pragma omp target
15958 #pragma omp teams distribute
15959   for (int i = 0; i < 10; ++i) {
15960 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
15961     for (int i = 0; i < 10; ++i)
15962       ++a;
15963   }
15964 #pragma omp target
15965 #pragma omp teams distribute
15966   for (int i = 0; i < 10; ++i) {
15967 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
15968     for (int i = 0; i < 10; ++i)
15969       ++a;
15970   }
15971 #pragma omp target
15972 #pragma omp teams distribute
15973   for (int i = 0; i < 10; ++i) {
15974 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
15975     for (int i = 0; i < 10; ++i)
15976       ++a;
15977   }
15978 #pragma omp target
15979 #pragma omp teams distribute
15980   for (int i = 0; i < 10; ++i) {
15981 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
15982     for (int i = 0; i < 10; ++i)
15983       ++a;
15984   }
15985 
15986 // TEAMS DISTRIBUTE SIMD DIRECTIVE
15987 #pragma omp teams distribute simd // omp45-error {{orphaned 'omp teams distribute simd' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
15988   for (int i = 0; i < 10; ++i)
15989     ;
15990 #pragma omp target
15991 #pragma omp teams distribute simd
15992   for (int i = 0; i < 10; ++i) {
15993 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15994     for (int i = 0; i < 10; ++i)
15995       ;
15996   }
15997 #pragma omp target
15998 #pragma omp teams distribute simd
15999   for (int i = 0; i < 10; ++i) {
16000 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16001     for (int i = 0; i < 10; ++i)
16002       ;
16003   }
16004 #pragma omp target
16005 #pragma omp teams distribute simd
16006   for (int i = 0; i < 10; ++i) {
16007 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16008     for (int i = 0; i < 10; ++i)
16009       ;
16010   }
16011 #pragma omp target
16012 #pragma omp teams distribute simd
16013   for (int i = 0; i < 10; ++i) {
16014 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
16015     for (int i = 0; i < 10; ++i)
16016       ;
16017   }
16018 #pragma omp target
16019 #pragma omp teams distribute simd
16020   for (int i = 0; i < 10; ++i) {
16021 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16022     for (int i = 0; i < 10; ++i)
16023       ;
16024   }
16025 #pragma omp target
16026 #pragma omp teams distribute simd
16027   for (int i = 0; i < 10; ++i) {
16028 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16029     for (int i = 0; i < 10; ++i)
16030       ;
16031   }
16032 #pragma omp target
16033 #pragma omp teams distribute simd
16034   for (int i = 0; i < 10; ++i) {
16035 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16036     {
16037       bar();
16038     }
16039   }
16040 #pragma omp target
16041 #pragma omp teams distribute simd
16042   for (int i = 0; i < 10; ++i) {
16043 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16044     {
16045       bar();
16046     }
16047   }
16048 #pragma omp target
16049 #pragma omp teams distribute simd
16050   for (int i = 0; i < 10; ++i) {
16051 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16052     {
16053       bar();
16054     }
16055   }
16056 #pragma omp target
16057 #pragma omp teams distribute simd
16058   for (int i = 0; i < 10; ++i) {
16059 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16060     {
16061       bar();
16062     }
16063   }
16064 #pragma omp target
16065 #pragma omp teams distribute simd
16066   for (int i = 0; i < 10; ++i) {
16067 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16068     {
16069       bar();
16070     }
16071   }
16072 #pragma omp target
16073 #pragma omp teams distribute simd
16074   for (int i = 0; i < 10; ++i) {
16075 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16076     {
16077 #pragma omp single
16078       {
16079         bar();
16080       }
16081     }
16082   }
16083 #pragma omp target
16084 #pragma omp teams distribute simd
16085   for (int i = 0; i < 10; ++i) {
16086 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16087     for (int i = 0; i < 10; ++i)
16088       ;
16089   }
16090 #pragma omp target
16091 #pragma omp teams distribute simd
16092   for (int i = 0; i < 10; ++i) {
16093 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16094     for (int i = 0; i < 10; ++i)
16095       ;
16096   }
16097 #pragma omp target
16098 #pragma omp teams distribute simd
16099   for (int i = 0; i < 10; ++i) {
16100 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16101     {
16102       bar();
16103     }
16104   }
16105 #pragma omp target
16106 #pragma omp teams distribute simd
16107   for (int i = 0; i < 10; ++i) {
16108 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16109     {
16110       bar();
16111     }
16112   }
16113 #pragma omp target
16114 #pragma omp teams distribute simd
16115   for (int i = 0; i < 10; ++i) {
16116 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16117     bar();
16118   }
16119 #pragma omp target
16120 #pragma omp teams distribute simd
16121   for (int i = 0; i < 10; ++i) {
16122 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16123     bar();
16124   }
16125 #pragma omp target
16126 #pragma omp teams distribute simd
16127   for (int i = 0; i < 10; ++i) {
16128 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16129     bar();
16130   }
16131 #pragma omp target
16132 #pragma omp teams distribute simd
16133   for (int i = 0; i < 10; ++i) {
16134 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16135     bar();
16136   }
16137 #pragma omp target
16138 #pragma omp teams distribute simd
16139   for (int i = 0; i < 10; ++i) {
16140 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16141     bar();
16142   }
16143 #pragma omp target
16144 #pragma omp teams distribute simd
16145   for (int i = 0; i < 10; ++i) {
16146 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
16147     ++a;
16148   }
16149 #pragma omp target
16150 #pragma omp teams distribute simd
16151   for (int i = 0; i < 10; ++i) {
16152 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16153     ++a;
16154   }
16155 #pragma omp target
16156 #pragma omp teams distribute simd
16157   for (int i = 0; i < 10; ++i) {
16158 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16159     ++a;
16160   }
16161 #pragma omp target
16162 #pragma omp teams distribute simd
16163   for (int i = 0; i < 10; ++i) {
16164 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16165     for (int i = 0; i < 10; ++i)
16166       ;
16167   }
16168 #pragma omp target
16169 #pragma omp teams distribute simd
16170   for (int i = 0; i < 10; ++i) {
16171 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16172     ++a;
16173   }
16174 #pragma omp target
16175 #pragma omp teams distribute simd
16176   for (int i = 0; i < 10; ++i) {
16177 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16178     ++a;
16179   }
16180 #pragma omp target
16181 #pragma omp teams distribute simd
16182   for (int i = 0; i < 10; ++i) {
16183 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16184     ++a;
16185   }
16186 #pragma omp target
16187 #pragma omp teams distribute simd
16188   for (int i = 0; i < 10; ++i) {
16189 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16190     ++a;
16191   }
16192 #pragma omp target
16193 #pragma omp teams distribute simd
16194   for (int i = 0; i < 10; ++i) {
16195 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16196     for (int i = 0; i < 10; ++i)
16197       ++a;
16198   }
16199 #pragma omp target
16200 #pragma omp teams distribute simd
16201   for (int i = 0; i < 10; ++i) {
16202 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16203     for (int i = 0; i < 10; ++i)
16204       ++a;
16205   }
16206 #pragma omp target
16207 #pragma omp teams distribute simd
16208   for (int i = 0; i < 10; ++i) {
16209 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16210     for (int i = 0; i < 10; ++i)
16211       ++a;
16212   }
16213 #pragma omp target
16214 #pragma omp teams distribute simd
16215   for (int i = 0; i < 10; ++i) {
16216 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16217     for (int i = 0; i < 10; ++i)
16218       ++a;
16219   }
16220 #pragma omp target
16221 #pragma omp teams distribute simd
16222   for (int i = 0; i < 10; ++i) {
16223 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16224     for (int i = 0; i < 10; ++i)
16225       ++a;
16226   }
16227 #pragma omp target
16228 #pragma omp teams distribute simd
16229   for (int i = 0; i < 10; ++i) {
16230 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16231     for (int i = 0; i < 10; ++i)
16232       ++a;
16233   }
16234 #pragma omp target
16235 #pragma omp teams distribute simd
16236   for (int i = 0; i < 10; ++i) {
16237 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16238     ++a;
16239   }
16240 #pragma omp target
16241 #pragma omp teams distribute simd
16242   for (int i = 0; i < 10; ++i) {
16243 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16244     for (int i = 0; i < 10; ++i)
16245       ++a;
16246   }
16247 #pragma omp target
16248 #pragma omp teams distribute simd
16249   for (int i = 0; i < 10; ++i) {
16250 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16251     for (int i = 0; i < 10; ++i)
16252       ++a;
16253   }
16254 #pragma omp target
16255 #pragma omp teams distribute simd
16256   for (int i = 0; i < 10; ++i) {
16257 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16258     for (int i = 0; i < 10; ++i)
16259       ++a;
16260   }
16261 #pragma omp target
16262 #pragma omp teams distribute simd
16263   for (int i = 0; i < 10; ++i) {
16264 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16265     for (int i = 0; i < 10; ++i)
16266       ++a;
16267   }
16268 
16269 // TEAMS DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
16270 #pragma omp teams distribute parallel for simd // omp45-error {{orphaned 'omp teams distribute parallel for simd' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
16271   for (int i = 0; i < 10; ++i)
16272     ;
16273 #pragma omp target
16274 #pragma omp teams distribute parallel for simd
16275   for (int i = 0; i < 10; ++i) {
16276 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16277     for (int i = 0; i < 10; ++i)
16278       ;
16279   }
16280 #pragma omp target
16281 #pragma omp teams distribute parallel for simd
16282   for (int i = 0; i < 10; ++i) {
16283 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16284     for (int i = 0; i < 10; ++i)
16285       ;
16286   }
16287 #pragma omp target
16288 #pragma omp teams distribute parallel for simd
16289   for (int i = 0; i < 10; ++i) {
16290 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16291     for (int i = 0; i < 10; ++i)
16292       ;
16293   }
16294 #pragma omp target
16295 #pragma omp teams distribute parallel for simd
16296   for (int i = 0; i < 10; ++i) {
16297 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
16298     for (int i = 0; i < 10; ++i)
16299       ;
16300   }
16301 #pragma omp target
16302 #pragma omp teams distribute parallel for simd
16303   for (int i = 0; i < 10; ++i) {
16304 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16305     for (int i = 0; i < 10; ++i)
16306       ;
16307   }
16308 #pragma omp target
16309 #pragma omp teams distribute parallel for simd
16310   for (int i = 0; i < 10; ++i) {
16311 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16312     for (int i = 0; i < 10; ++i)
16313       ;
16314   }
16315 #pragma omp target
16316 #pragma omp teams distribute parallel for simd
16317   for (int i = 0; i < 10; ++i) {
16318 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16319     {
16320       bar();
16321     }
16322   }
16323 #pragma omp target
16324 #pragma omp teams distribute parallel for simd
16325   for (int i = 0; i < 10; ++i) {
16326 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16327     {
16328       bar();
16329     }
16330   }
16331 #pragma omp target
16332 #pragma omp teams distribute parallel for simd
16333   for (int i = 0; i < 10; ++i) {
16334 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16335     {
16336       bar();
16337     }
16338   }
16339 #pragma omp target
16340 #pragma omp teams distribute parallel for simd
16341   for (int i = 0; i < 10; ++i) {
16342 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16343     {
16344       bar();
16345     }
16346   }
16347 #pragma omp target
16348 #pragma omp teams distribute parallel for simd
16349   for (int i = 0; i < 10; ++i) {
16350 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16351     {
16352       bar();
16353     }
16354   }
16355 #pragma omp target
16356 #pragma omp teams distribute parallel for simd
16357   for (int i = 0; i < 10; ++i) {
16358 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16359     {
16360 #pragma omp single
16361       {
16362         bar();
16363       }
16364     }
16365   }
16366 #pragma omp target
16367 #pragma omp teams distribute parallel for simd
16368   for (int i = 0; i < 10; ++i) {
16369 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16370     for (int i = 0; i < 10; ++i)
16371       ;
16372   }
16373 #pragma omp target
16374 #pragma omp teams distribute parallel for simd
16375   for (int i = 0; i < 10; ++i) {
16376 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16377     for (int i = 0; i < 10; ++i)
16378       ;
16379   }
16380 #pragma omp target
16381 #pragma omp teams distribute parallel for simd
16382   for (int i = 0; i < 10; ++i) {
16383 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16384     {
16385       bar();
16386     }
16387   }
16388 #pragma omp target
16389 #pragma omp teams distribute parallel for simd
16390   for (int i = 0; i < 10; ++i) {
16391 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16392     {
16393       bar();
16394     }
16395   }
16396 #pragma omp target
16397 #pragma omp teams distribute parallel for simd
16398   for (int i = 0; i < 10; ++i) {
16399 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16400     bar();
16401   }
16402 #pragma omp target
16403 #pragma omp teams distribute parallel for simd
16404   for (int i = 0; i < 10; ++i) {
16405 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16406     bar();
16407   }
16408 #pragma omp target
16409 #pragma omp teams distribute parallel for simd
16410   for (int i = 0; i < 10; ++i) {
16411 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16412     bar();
16413   }
16414 #pragma omp target
16415 #pragma omp teams distribute parallel for simd
16416   for (int i = 0; i < 10; ++i) {
16417 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16418     bar();
16419   }
16420 #pragma omp target
16421 #pragma omp teams distribute parallel for simd
16422   for (int i = 0; i < 10; ++i) {
16423 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16424     bar();
16425   }
16426 #pragma omp target
16427 #pragma omp teams distribute parallel for simd
16428   for (int i = 0; i < 10; ++i) {
16429 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
16430     ++a;
16431   }
16432 #pragma omp target
16433 #pragma omp teams distribute parallel for simd
16434   for (int i = 0; i < 10; ++i) {
16435 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16436     ++a;
16437   }
16438 #pragma omp target
16439 #pragma omp teams distribute parallel for simd
16440   for (int i = 0; i < 10; ++i) {
16441 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16442     ++a;
16443   }
16444 #pragma omp target
16445 #pragma omp teams distribute parallel for simd
16446   for (int i = 0; i < 10; ++i) {
16447 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16448     for (int i = 0; i < 10; ++i)
16449       ;
16450   }
16451 #pragma omp target
16452 #pragma omp teams distribute parallel for simd
16453   for (int i = 0; i < 10; ++i) {
16454 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16455     ++a;
16456   }
16457 #pragma omp target
16458 #pragma omp teams distribute parallel for simd
16459   for (int i = 0; i < 10; ++i) {
16460 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16461     ++a;
16462   }
16463 #pragma omp target
16464 #pragma omp teams distribute parallel for simd
16465   for (int i = 0; i < 10; ++i) {
16466 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16467     ++a;
16468   }
16469 #pragma omp target
16470 #pragma omp teams distribute parallel for simd
16471   for (int i = 0; i < 10; ++i) {
16472 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16473     ++a;
16474   }
16475 #pragma omp target
16476 #pragma omp teams distribute parallel for simd
16477   for (int i = 0; i < 10; ++i) {
16478 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16479     for (int i = 0; i < 10; ++i)
16480       ++a;
16481   }
16482 #pragma omp target
16483 #pragma omp teams distribute parallel for simd
16484   for (int i = 0; i < 10; ++i) {
16485 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16486     for (int i = 0; i < 10; ++i)
16487       ++a;
16488   }
16489 #pragma omp target
16490 #pragma omp teams distribute parallel for simd
16491   for (int i = 0; i < 10; ++i) {
16492 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16493     for (int i = 0; i < 10; ++i)
16494       ++a;
16495   }
16496 #pragma omp target
16497 #pragma omp teams distribute parallel for simd
16498   for (int i = 0; i < 10; ++i) {
16499 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16500     for (int i = 0; i < 10; ++i)
16501       ++a;
16502   }
16503 #pragma omp target
16504 #pragma omp teams distribute parallel for simd
16505   for (int i = 0; i < 10; ++i) {
16506 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16507     for (int i = 0; i < 10; ++i)
16508       ++a;
16509   }
16510 #pragma omp target
16511 #pragma omp teams distribute parallel for simd
16512   for (int i = 0; i < 10; ++i) {
16513 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16514     for (int i = 0; i < 10; ++i)
16515       ++a;
16516   }
16517 #pragma omp target
16518 #pragma omp teams distribute parallel for simd
16519   for (int i = 0; i < 10; ++i) {
16520 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16521     ++a;
16522   }
16523 #pragma omp target
16524 #pragma omp teams distribute parallel for simd
16525   for (int i = 0; i < 10; ++i) {
16526 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16527     for (int i = 0; i < 10; ++i)
16528       ++a;
16529   }
16530 #pragma omp target
16531 #pragma omp teams distribute parallel for simd
16532   for (int i = 0; i < 10; ++i) {
16533 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16534     for (int i = 0; i < 10; ++i)
16535       ++a;
16536   }
16537 #pragma omp target
16538 #pragma omp teams distribute parallel for simd
16539   for (int i = 0; i < 10; ++i) {
16540 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16541     for (int i = 0; i < 10; ++i)
16542       ++a;
16543   }
16544 #pragma omp target
16545 #pragma omp teams distribute parallel for simd
16546   for (int i = 0; i < 10; ++i) {
16547 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16548     for (int i = 0; i < 10; ++i)
16549       ++a;
16550   }
16551 
16552 // TEAMS DISTRIBUTE PARALLEL FOR DIRECTIVE
16553 #pragma omp teams distribute parallel for // omp45-error {{orphaned 'omp teams distribute parallel for' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
16554   for (int i = 0; i < 10; ++i)
16555     ;
16556 #pragma omp target
16557 #pragma omp teams distribute parallel for
16558   for (int i = 0; i < 10; ++i) {
16559 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
16560     for (int i = 0; i < 10; ++i)
16561       ;
16562   }
16563 #pragma omp target
16564 #pragma omp teams distribute parallel for
16565   for (int i = 0; i < 10; ++i) {
16566 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
16567     for (int i = 0; i < 10; ++i)
16568       ;
16569   }
16570 #pragma omp target
16571 #pragma omp teams distribute parallel for
16572   for (int i = 0; i < 10; ++i) {
16573 #pragma omp for // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
16574     for (int i = 0; i < 10; ++i)
16575       ;
16576   }
16577 #pragma omp target
16578 #pragma omp teams distribute parallel for
16579   for (int i = 0; i < 10; ++i) {
16580 #pragma omp simd // OK
16581     for (int i = 0; i < 10; ++i)
16582       ;
16583   }
16584 #pragma omp target
16585 #pragma omp teams distribute parallel for
16586   for (int i = 0; i < 10; ++i) {
16587 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
16588     for (int i = 0; i < 10; ++i)
16589       ;
16590   }
16591 #pragma omp target
16592 #pragma omp teams distribute parallel for
16593   for (int i = 0; i < 10; ++i) {
16594 #pragma omp parallel // OK
16595     for (int i = 0; i < 10; ++i)
16596       ;
16597   }
16598 #pragma omp target
16599 #pragma omp teams distribute parallel for
16600   for (int i = 0; i < 10; ++i) {
16601 #pragma omp sections // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
16602     {
16603       bar();
16604     }
16605   }
16606 #pragma omp target
16607 #pragma omp teams distribute parallel for
16608   for (int i = 0; i < 10; ++i) {
16609 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute parallel for region}}
16610     {
16611       bar();
16612     }
16613   }
16614 #pragma omp target
16615 #pragma omp teams distribute parallel for
16616   for (int i = 0; i < 10; ++i) {
16617 #pragma omp single // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
16618     {
16619       bar();
16620     }
16621   }
16622 #pragma omp target
16623 #pragma omp teams distribute parallel for
16624   for (int i = 0; i < 10; ++i) {
16625 #pragma omp master // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region}}
16626     {
16627       bar();
16628     }
16629   }
16630 #pragma omp target
16631 #pragma omp teams distribute parallel for
16632   for (int i = 0; i < 10; ++i) {
16633 #pragma omp critical // OK
16634     {
16635       bar();
16636     }
16637   }
16638 #pragma omp target
16639 #pragma omp teams distribute parallel for
16640   for (int i = 0; i < 10; ++i) {
16641 #pragma omp parallel // OK
16642     {
16643 #pragma omp single
16644       {
16645         bar();
16646       }
16647     }
16648   }
16649 #pragma omp target
16650 #pragma omp teams distribute parallel for
16651   for (int i = 0; i < 10; ++i) {
16652 #pragma omp parallel for // OK
16653     for (int i = 0; i < 10; ++i)
16654       ;
16655   }
16656 #pragma omp target
16657 #pragma omp teams distribute parallel for
16658   for (int i = 0; i < 10; ++i) {
16659 #pragma omp parallel for simd // OK
16660     for (int i = 0; i < 10; ++i)
16661       ;
16662   }
16663 #pragma omp target
16664 #pragma omp teams distribute parallel for
16665   for (int i = 0; i < 10; ++i) {
16666 #pragma omp parallel sections // OK
16667     {
16668       bar();
16669     }
16670   }
16671 #pragma omp target
16672 #pragma omp teams distribute parallel for
16673   for (int i = 0; i < 10; ++i) {
16674 #pragma omp task // OK
16675     {
16676       bar();
16677     }
16678   }
16679 #pragma omp target
16680 #pragma omp teams distribute parallel for
16681   for (int i = 0; i < 10; ++i) {
16682 #pragma omp taskyield // OK
16683     bar();
16684   }
16685 #pragma omp target
16686 #pragma omp teams distribute parallel for
16687   for (int i = 0; i < 10; ++i) {
16688 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region}}
16689     bar();
16690   }
16691 #pragma omp target
16692 #pragma omp teams distribute parallel for
16693   for (int i = 0; i < 10; ++i) {
16694 #pragma omp taskwait // OK
16695     bar();
16696   }
16697 #pragma omp target
16698 #pragma omp teams distribute parallel for
16699   for (int i = 0; i < 10; ++i) {
16700 #pragma omp flush // OK
16701     bar();
16702   }
16703 #pragma omp target
16704 #pragma omp teams distribute parallel for
16705   for (int i = 0; i < 10; ++i) {
16706 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
16707     bar();
16708   }
16709 #pragma omp target
16710 #pragma omp teams distribute parallel for
16711   for (int i = 0; i < 10; ++i) {
16712 #pragma omp atomic // OK
16713     ++a;
16714   }
16715 #pragma omp target
16716 #pragma omp teams distribute parallel for
16717   for (int i = 0; i < 10; ++i) {
16718 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
16719     ++a;
16720   }
16721 #pragma omp target
16722 #pragma omp teams distribute parallel for
16723   for (int i = 0; i < 10; ++i) {
16724 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
16725     ++a;
16726   }
16727 #pragma omp target
16728 #pragma omp teams distribute parallel for
16729   for (int i = 0; i < 10; ++i) {
16730 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
16731     for (int i = 0; i < 10; ++i)
16732       ;
16733   }
16734 #pragma omp target
16735 #pragma omp teams distribute parallel for
16736   for (int i = 0; i < 10; ++i) {
16737 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
16738     ++a;
16739   }
16740 #pragma omp target
16741 #pragma omp teams distribute parallel for
16742   for (int i = 0; i < 10; ++i) {
16743 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
16744     ++a;
16745   }
16746 #pragma omp target
16747 #pragma omp teams distribute parallel for
16748   for (int i = 0; i < 10; ++i) {
16749 #pragma omp teams // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
16750     ++a;
16751   }
16752 #pragma omp target
16753 #pragma omp teams distribute parallel for
16754   for (int i = 0; i < 10; ++i) {
16755 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
16756     ++a;
16757   }
16758 #pragma omp target
16759 #pragma omp teams distribute parallel for
16760   for (int i = 0; i < 10; ++i) {
16761 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
16762     for (int i = 0; i < 10; ++i)
16763       ++a;
16764   }
16765 #pragma omp target
16766 #pragma omp teams distribute parallel for
16767   for (int i = 0; i < 10; ++i) {
16768 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
16769     for (int i = 0; i < 10; ++i)
16770       ++a;
16771   }
16772 #pragma omp target
16773 #pragma omp teams distribute parallel for
16774   for (int i = 0; i < 10; ++i) {
16775 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
16776     for (int i = 0; i < 10; ++i)
16777       ++a;
16778   }
16779 #pragma omp target
16780 #pragma omp teams distribute parallel for
16781   for (int i = 0; i < 10; ++i) {
16782 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
16783     for (int i = 0; i < 10; ++i)
16784       ++a;
16785   }
16786 #pragma omp target
16787 #pragma omp teams distribute parallel for
16788   for (int i = 0; i < 10; ++i) {
16789 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
16790     for (int i = 0; i < 10; ++i)
16791       ++a;
16792   }
16793 #pragma omp target
16794 #pragma omp teams distribute parallel for
16795   for (int i = 0; i < 10; ++i) {
16796 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
16797     for (int i = 0; i < 10; ++i)
16798       ++a;
16799   }
16800 #pragma omp target
16801 #pragma omp teams distribute parallel for
16802   for (int i = 0; i < 10; ++i) {
16803 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
16804     ++a;
16805   }
16806 #pragma omp target
16807 #pragma omp teams distribute parallel for
16808   for (int i = 0; i < 10; ++i) {
16809 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
16810     for (int i = 0; i < 10; ++i)
16811       ++a;
16812   }
16813 #pragma omp target
16814 #pragma omp teams distribute parallel for
16815   for (int i = 0; i < 10; ++i) {
16816 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
16817     for (int i = 0; i < 10; ++i)
16818       ++a;
16819   }
16820 #pragma omp target
16821 #pragma omp teams distribute parallel for
16822   for (int i = 0; i < 10; ++i) {
16823 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
16824     for (int i = 0; i < 10; ++i)
16825       ++a;
16826   }
16827 #pragma omp target
16828 #pragma omp teams distribute parallel for
16829   for (int i = 0; i < 10; ++i) {
16830 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
16831     for (int i = 0; i < 10; ++i)
16832       ++a;
16833   }
16834 
16835 // TARGET TEAMS DIRECTIVE
16836 #pragma omp target teams
16837 #pragma omp parallel
16838   bar();
16839 #pragma omp target teams
16840 #pragma omp for // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
16841   for (int i = 0; i < 10; ++i)
16842     ;
16843 #pragma omp target teams
16844 #pragma omp simd // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp simd' directive into a parallel region?}}
16845   for (int i = 0; i < 10; ++i)
16846     ;
16847 #pragma omp target teams
16848 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
16849   for (int i = 0; i < 10; ++i)
16850     ;
16851 #pragma omp target teams
16852 #pragma omp sections // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
16853   {
16854     bar();
16855   }
16856 #pragma omp target teams
16857 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams region}}
16858   {
16859     bar();
16860   }
16861 #pragma omp target teams
16862 #pragma omp single // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}}
16863   bar();
16864 
16865 #pragma omp target teams
16866 #pragma omp master // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp master' directive into a parallel region?}}
16867   {
16868     bar();
16869   }
16870 #pragma omp target teams
16871 #pragma omp critical // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp critical' directive into a parallel region?}}
16872   {
16873     bar();
16874   }
16875 #pragma omp target teams
16876 #pragma omp parallel for
16877   for (int i = 0; i < 10; ++i)
16878     ;
16879 #pragma omp target teams
16880 #pragma omp parallel for simd
16881   for (int i = 0; i < 10; ++i)
16882     ;
16883 #pragma omp target teams
16884 #pragma omp parallel sections
16885   {
16886     bar();
16887   }
16888 #pragma omp target teams
16889 #pragma omp task // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp task' directive into a parallel region?}}
16890   {
16891     bar();
16892   }
16893 #pragma omp target teams
16894   {
16895 #pragma omp taskyield // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp taskyield' directive into a parallel region?}}
16896     bar();
16897   }
16898 #pragma omp target teams
16899   {
16900 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp barrier' directive into a parallel region?}}
16901     bar();
16902   }
16903 #pragma omp target teams
16904   {
16905 #pragma omp taskwait // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp taskwait' directive into a parallel region?}}
16906     bar();
16907   }
16908 #pragma omp target teams
16909   {
16910 #pragma omp flush // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp flush' directive into a parallel region?}}
16911     bar();
16912   }
16913 #pragma omp target teams
16914   {
16915 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
16916     bar();
16917   }
16918 #pragma omp target teams
16919   {
16920 #pragma omp atomic // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp atomic' directive into a parallel region?}}
16921     ++a;
16922   }
16923 #pragma omp target teams
16924   {
16925 #pragma omp target // expected-error {{region cannot be nested inside 'target teams' region}}
16926     ++a;
16927   }
16928 #pragma omp target teams
16929   {
16930 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target teams' region}}
16931     ++a;
16932   }
16933 #pragma omp target teams
16934 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams' region}}
16935   for (int i = 0; i < 10; ++i)
16936     ;
16937 #pragma omp target teams
16938   {
16939 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams' region}}
16940   }
16941 #pragma omp target teams
16942   {
16943 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams' region}}
16944   }
16945 #pragma omp target teams
16946   {
16947 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
16948     ++a;
16949   }
16950 #pragma omp target teams
16951   {
16952 #pragma omp taskloop // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp taskloop' directive into a parallel region?}}
16953   for (int i = 0; i < 10; ++i)
16954     ++a;
16955   }
16956 #pragma omp target teams
16957 #pragma omp distribute
16958   for (int i = 0; i < 10; ++i)
16959     ;
16960 #pragma omp target teams
16961   {
16962 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams' region}}
16963     ++a;
16964   }
16965 #pragma omp target teams
16966 #pragma omp distribute parallel for
16967   for (int i = 0; i < 10; ++i)
16968     ;
16969 #pragma omp target teams
16970   {
16971 #pragma omp distribute parallel for
16972   for (int i = 0; i < 10; ++i)
16973     ;
16974 #pragma omp distribute parallel for
16975   for (int j = 0; j < 10; ++j)
16976     ;
16977   }
16978 #pragma omp target teams
16979   {
16980 #pragma omp distribute parallel for simd
16981   for (int i = 0; i < 10; ++i)
16982     ;
16983 #pragma omp distribute parallel for simd
16984   for (int j = 0; j < 10; ++j)
16985     ;
16986   }
16987 #pragma omp target teams
16988   {
16989 #pragma omp distribute simd
16990   for (int i = 0; i < 10; ++i)
16991     ;
16992 #pragma omp distribute simd
16993   for (int j = 0; j < 10; ++j)
16994     ;
16995   }
16996 #pragma omp target teams
16997   {
16998 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams' region}}
16999   for (int i = 0; i < 10; ++i)
17000     ;
17001   }
17002 #pragma omp target teams
17003   {
17004 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
17005   for (int i = 0; i < 10; ++i)
17006     ;
17007   }
17008 #pragma omp target teams
17009   {
17010 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
17011   for (int i = 0; i < 10; ++i)
17012     ;
17013   }
17014 #pragma omp target teams
17015   {
17016 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
17017   for (int i = 0; i < 10; ++i)
17018     ;
17019   }
17020 #pragma omp target teams
17021   {
17022 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target teams' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
17023   for (int i = 0; i < 10; ++i)
17024     ;
17025   }
17026 #pragma omp target teams
17027   {
17028 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams' region}}
17029     a++;
17030   }
17031 #pragma omp target teams
17032   {
17033 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams' region}}
17034   for (int i = 0; i < 10; ++i)
17035     ;
17036   }
17037 #pragma omp target teams
17038   {
17039 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams' region}}
17040   for (int i = 0; i < 10; ++i)
17041     ;
17042   }
17043 #pragma omp target teams
17044   {
17045 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams' region}}
17046   for (int i = 0; i < 10; ++i)
17047     ;
17048   }
17049 #pragma omp target teams
17050   {
17051 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams' region}}
17052   for (int i = 0; i < 10; ++i)
17053     ;
17054   }
17055 
17056 // TARGET TEAMS DISTRIBUTE DIRECTIVE
17057 #pragma omp target teams distribute // OK
17058   for (int i = 0; i < 10; ++i)
17059     ;
17060 #pragma omp target teams distribute
17061   for (int i = 0; i < 10; ++i) {
17062 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
17063     for (int i = 0; i < 10; ++i)
17064       ;
17065   }
17066 #pragma omp target teams distribute
17067   for (int i = 0; i < 10; ++i) {
17068 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
17069     for (int i = 0; i < 10; ++i)
17070       ;
17071   }
17072 #pragma omp target teams distribute
17073   for (int i = 0; i < 10; ++i) {
17074 #pragma omp for // OK
17075     for (int i = 0; i < 10; ++i)
17076       ;
17077   }
17078 #pragma omp target teams distribute
17079   for (int i = 0; i < 10; ++i) {
17080 #pragma omp simd // OK
17081     for (int i = 0; i < 10; ++i)
17082       ;
17083   }
17084 #pragma omp target teams distribute
17085   for (int i = 0; i < 10; ++i) {
17086 #pragma omp for simd // OK
17087     for (int i = 0; i < 10; ++i)
17088       ;
17089   }
17090 #pragma omp target teams distribute
17091   for (int i = 0; i < 10; ++i) {
17092 #pragma omp parallel // OK
17093     for (int i = 0; i < 10; ++i)
17094       ;
17095   }
17096 #pragma omp target teams distribute
17097   for (int i = 0; i < 10; ++i) {
17098 #pragma omp sections // OK
17099     {
17100       bar();
17101     }
17102   }
17103 #pragma omp target teams distribute
17104   for (int i = 0; i < 10; ++i) {
17105 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams distribute region}}
17106     {
17107       bar();
17108     }
17109   }
17110 #pragma omp target teams distribute
17111   for (int i = 0; i < 10; ++i) {
17112 #pragma omp single // OK
17113     {
17114       bar();
17115     }
17116   }
17117 #pragma omp target teams distribute
17118   for (int i = 0; i < 10; ++i) {
17119 #pragma omp master // OK
17120     {
17121       bar();
17122     }
17123   }
17124 #pragma omp target teams distribute
17125   for (int i = 0; i < 10; ++i) {
17126 #pragma omp critical // OK
17127     {
17128       bar();
17129     }
17130   }
17131 #pragma omp target teams distribute
17132   for (int i = 0; i < 10; ++i) {
17133 #pragma omp parallel // OK
17134     {
17135 #pragma omp single
17136       {
17137         bar();
17138       }
17139     }
17140   }
17141 #pragma omp target teams distribute
17142   for (int i = 0; i < 10; ++i) {
17143 #pragma omp parallel for // OK
17144     for (int i = 0; i < 10; ++i)
17145       ;
17146   }
17147 #pragma omp target teams distribute
17148   for (int i = 0; i < 10; ++i) {
17149 #pragma omp parallel for simd // OK
17150     for (int i = 0; i < 10; ++i)
17151       ;
17152   }
17153 #pragma omp target teams distribute
17154   for (int i = 0; i < 10; ++i) {
17155 #pragma omp parallel sections // OK
17156     {
17157       bar();
17158     }
17159   }
17160 #pragma omp target teams distribute
17161   for (int i = 0; i < 10; ++i) {
17162 #pragma omp task // OK
17163     {
17164       bar();
17165     }
17166   }
17167 #pragma omp target teams distribute
17168   for (int i = 0; i < 10; ++i) {
17169 #pragma omp taskyield // OK
17170     bar();
17171   }
17172 #pragma omp target teams distribute
17173   for (int i = 0; i < 10; ++i) {
17174 #pragma omp barrier // OK
17175     bar();
17176   }
17177 #pragma omp target teams distribute
17178   for (int i = 0; i < 10; ++i) {
17179 #pragma omp taskwait // OK
17180     bar();
17181   }
17182 #pragma omp target teams distribute
17183   for (int i = 0; i < 10; ++i) {
17184 #pragma omp flush // OK
17185     bar();
17186   }
17187 #pragma omp target teams distribute
17188   for (int i = 0; i < 10; ++i) {
17189 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
17190     bar();
17191   }
17192 #pragma omp target teams distribute
17193   for (int i = 0; i < 10; ++i) {
17194 #pragma omp atomic // OK
17195     ++a;
17196   }
17197 #pragma omp target teams distribute
17198   for (int i = 0; i < 10; ++i) {
17199 #pragma omp target // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17200     ++a;
17201   }
17202 #pragma omp target teams distribute
17203   for (int i = 0; i < 10; ++i) {
17204 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17205     ++a;
17206   }
17207 #pragma omp target teams distribute
17208   for (int i = 0; i < 10; ++i) {
17209 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17210     for (int i = 0; i < 10; ++i)
17211       ;
17212   }
17213 #pragma omp target teams distribute
17214   for (int i = 0; i < 10; ++i) {
17215 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17216     ++a;
17217   }
17218 #pragma omp target teams distribute
17219   for (int i = 0; i < 10; ++i) {
17220 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17221     ++a;
17222   }
17223 #pragma omp target teams distribute
17224   for (int i = 0; i < 10; ++i) {
17225 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
17226     ++a;
17227   }
17228 #pragma omp target teams distribute
17229   for (int i = 0; i < 10; ++i) {
17230 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17231     ++a;
17232   }
17233 #pragma omp target teams distribute
17234   for (int i = 0; i < 10; ++i) {
17235 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
17236     for (int i = 0; i < 10; ++i)
17237       ++a;
17238   }
17239 #pragma omp target teams distribute
17240   for (int i = 0; i < 10; ++i) {
17241 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17242     for (int i = 0; i < 10; ++i)
17243       ++a;
17244   }
17245 #pragma omp target teams distribute
17246   for (int i = 0; i < 10; ++i) {
17247 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
17248     for (int i = 0; i < 10; ++i)
17249       ++a;
17250   }
17251 #pragma omp target teams distribute
17252   for (int i = 0; i < 10; ++i) {
17253 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
17254     for (int i = 0; i < 10; ++i)
17255       ++a;
17256   }
17257 #pragma omp target teams distribute
17258   for (int i = 0; i < 10; ++i) {
17259 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
17260     for (int i = 0; i < 10; ++i)
17261       ++a;
17262   }
17263 #pragma omp target teams distribute
17264   for (int i = 0; i < 10; ++i) {
17265 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target teams distribute' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
17266     for (int i = 0; i < 10; ++i)
17267       ++a;
17268   }
17269 #pragma omp target teams distribute
17270   for (int i = 0; i < 10; ++i) {
17271 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17272     ++a;
17273   }
17274 #pragma omp target teams distribute
17275   for (int i = 0; i < 10; ++i) {
17276 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17277     for (int i = 0; i < 10; ++i)
17278       ++a;
17279   }
17280 #pragma omp target teams distribute
17281   for (int i = 0; i < 10; ++i) {
17282 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17283     for (int i = 0; i < 10; ++i)
17284       ++a;
17285   }
17286 #pragma omp target teams distribute
17287   for (int i = 0; i < 10; ++i) {
17288 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17289     for (int i = 0; i < 10; ++i)
17290       ++a;
17291   }
17292 #pragma omp target teams distribute
17293   for (int i = 0; i < 10; ++i) {
17294 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
17295     for (int i = 0; i < 10; ++i)
17296       ++a;
17297   }
17298 
17299 // TARGET TEAMS DISTRIBUTE PARALLEL FOR DIRECTIVE
17300 #pragma omp target teams distribute parallel for // OK
17301   for (int i = 0; i < 10; ++i)
17302     ;
17303 #pragma omp target teams distribute parallel for
17304   for (int i = 0; i < 10; ++i) {
17305 #pragma omp distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute parallel for simd' directive into a teams region?}}
17306     for (int i = 0; i < 10; ++i)
17307       ;
17308   }
17309 #pragma omp target teams distribute parallel for
17310   for (int i = 0; i < 10; ++i) {
17311 #pragma omp distribute // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
17312     for (int i = 0; i < 10; ++i)
17313       ;
17314   }
17315 #pragma omp target teams distribute parallel for
17316   for (int i = 0; i < 10; ++i) {
17317 #pragma omp for // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
17318     for (int i = 0; i < 10; ++i)
17319       ;
17320   }
17321 #pragma omp target teams distribute parallel for
17322   for (int i = 0; i < 10; ++i) {
17323 #pragma omp simd // OK
17324     for (int i = 0; i < 10; ++i)
17325       ;
17326   }
17327 #pragma omp target teams distribute parallel for
17328   for (int i = 0; i < 10; ++i) {
17329 #pragma omp for simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp for simd' directive into a parallel region?}}
17330     for (int i = 0; i < 10; ++i)
17331       ;
17332   }
17333 #pragma omp target teams distribute parallel for
17334   for (int i = 0; i < 10; ++i) {
17335 #pragma omp parallel // OK
17336     for (int i = 0; i < 10; ++i)
17337       ;
17338   }
17339 #pragma omp target teams distribute parallel for
17340   for (int i = 0; i < 10; ++i) {
17341 #pragma omp sections // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp sections' directive into a parallel region?}}
17342     {
17343       bar();
17344     }
17345   }
17346 #pragma omp target teams distribute parallel for
17347   for (int i = 0; i < 10; ++i) {
17348 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams distribute parallel for region}}
17349     {
17350       bar();
17351     }
17352   }
17353 #pragma omp target teams distribute parallel for
17354   for (int i = 0; i < 10; ++i) {
17355 #pragma omp single // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
17356     {
17357       bar();
17358     }
17359   }
17360 #pragma omp target teams distribute parallel for
17361   for (int i = 0; i < 10; ++i) {
17362 #pragma omp master // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
17363     {
17364       bar();
17365     }
17366   }
17367 #pragma omp target teams distribute parallel for
17368   for (int i = 0; i < 10; ++i) {
17369 #pragma omp critical // OK
17370     {
17371       bar();
17372     }
17373   }
17374 #pragma omp target teams distribute parallel for
17375   for (int i = 0; i < 10; ++i) {
17376 #pragma omp parallel // OK
17377     {
17378 #pragma omp single
17379       {
17380         bar();
17381       }
17382     }
17383   }
17384 #pragma omp target teams distribute parallel for
17385   for (int i = 0; i < 10; ++i) {
17386 #pragma omp parallel for // OK
17387     for (int i = 0; i < 10; ++i)
17388       ;
17389   }
17390 #pragma omp target teams distribute parallel for
17391   for (int i = 0; i < 10; ++i) {
17392 #pragma omp parallel for simd // OK
17393     for (int i = 0; i < 10; ++i)
17394       ;
17395   }
17396 #pragma omp target teams distribute parallel for
17397   for (int i = 0; i < 10; ++i) {
17398 #pragma omp parallel sections // OK
17399     {
17400       bar();
17401     }
17402   }
17403 #pragma omp target teams distribute parallel for
17404   for (int i = 0; i < 10; ++i) {
17405 #pragma omp task // OK
17406     {
17407       bar();
17408     }
17409   }
17410 #pragma omp target teams distribute parallel for
17411   for (int i = 0; i < 10; ++i) {
17412 #pragma omp taskyield // OK
17413     bar();
17414   }
17415 #pragma omp target teams distribute parallel for
17416   for (int i = 0; i < 10; ++i) {
17417 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
17418     bar();
17419   }
17420 #pragma omp target teams distribute parallel for
17421   for (int i = 0; i < 10; ++i) {
17422 #pragma omp taskwait // OK
17423     bar();
17424   }
17425 #pragma omp target teams distribute parallel for
17426   for (int i = 0; i < 10; ++i) {
17427 #pragma omp flush // OK
17428     bar();
17429   }
17430 #pragma omp target teams distribute parallel for
17431   for (int i = 0; i < 10; ++i) {
17432 #pragma omp ordered // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
17433     bar();
17434   }
17435 #pragma omp target teams distribute parallel for
17436   for (int i = 0; i < 10; ++i) {
17437 #pragma omp atomic // OK
17438     ++a;
17439   }
17440 #pragma omp target teams distribute parallel for
17441   for (int i = 0; i < 10; ++i) {
17442 #pragma omp target // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17443     ++a;
17444   }
17445 #pragma omp target teams distribute parallel for
17446   for (int i = 0; i < 10; ++i) {
17447 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17448     ++a;
17449   }
17450 #pragma omp target teams distribute parallel for
17451   for (int i = 0; i < 10; ++i) {
17452 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17453     for (int i = 0; i < 10; ++i)
17454       ;
17455   }
17456 #pragma omp target teams distribute parallel for
17457   for (int i = 0; i < 10; ++i) {
17458 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17459     ++a;
17460   }
17461 #pragma omp target teams distribute parallel for
17462   for (int i = 0; i < 10; ++i) {
17463 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17464     ++a;
17465   }
17466 #pragma omp target teams distribute parallel for
17467   for (int i = 0; i < 10; ++i) {
17468 #pragma omp teams // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
17469     ++a;
17470   }
17471 #pragma omp target teams distribute parallel for
17472   for (int i = 0; i < 10; ++i) {
17473 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17474     ++a;
17475   }
17476 #pragma omp target teams distribute parallel for
17477   for (int i = 0; i < 10; ++i) {
17478 #pragma omp distribute simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp distribute simd' directive into a teams region?}}
17479     for (int i = 0; i < 10; ++i)
17480       ++a;
17481   }
17482 #pragma omp target teams distribute parallel for
17483   for (int i = 0; i < 10; ++i) {
17484 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17485     for (int i = 0; i < 10; ++i)
17486       ++a;
17487   }
17488 #pragma omp target teams distribute parallel for
17489   for (int i = 0; i < 10; ++i) {
17490 #pragma omp teams distribute // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute' directive into a target region?}}
17491     for (int i = 0; i < 10; ++i)
17492       ++a;
17493   }
17494 #pragma omp target teams distribute parallel for
17495   for (int i = 0; i < 10; ++i) {
17496 #pragma omp teams distribute simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute simd' directive into a target region?}}
17497     for (int i = 0; i < 10; ++i)
17498       ++a;
17499   }
17500 #pragma omp target teams distribute parallel for
17501   for (int i = 0; i < 10; ++i) {
17502 #pragma omp teams distribute parallel for simd // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for simd' directive into a target region?}}
17503     for (int i = 0; i < 10; ++i)
17504       ++a;
17505   }
17506 #pragma omp target teams distribute parallel for
17507   for (int i = 0; i < 10; ++i) {
17508 #pragma omp teams distribute parallel for // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp teams distribute parallel for' directive into a target region?}}
17509     for (int i = 0; i < 10; ++i)
17510       ++a;
17511   }
17512 #pragma omp target teams distribute parallel for
17513   for (int i = 0; i < 10; ++i) {
17514 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17515     ++a;
17516   }
17517 #pragma omp target teams distribute parallel for
17518   for (int i = 0; i < 10; ++i) {
17519 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17520     for (int i = 0; i < 10; ++i)
17521       ++a;
17522   }
17523 #pragma omp target teams distribute parallel for
17524   for (int i = 0; i < 10; ++i) {
17525 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17526     for (int i = 0; i < 10; ++i)
17527       ++a;
17528   }
17529 #pragma omp target teams distribute parallel for
17530   for (int i = 0; i < 10; ++i) {
17531 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17532     for (int i = 0; i < 10; ++i)
17533       ++a;
17534   }
17535 #pragma omp target teams distribute parallel for
17536   for (int i = 0; i < 10; ++i) {
17537 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17538     for (int i = 0; i < 10; ++i)
17539       ++a;
17540   }
17541 
17542 // TARGET TEAMS DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
17543 #pragma omp target teams distribute parallel for simd // OK
17544   for (int i = 0; i < 10; ++i)
17545     ;
17546 #pragma omp target teams distribute parallel for simd
17547   for (int i = 0; i < 10; ++i) {
17548 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17549     for (int i = 0; i < 10; ++i)
17550       ;
17551   }
17552 #pragma omp target teams distribute parallel for simd
17553   for (int i = 0; i < 10; ++i) {
17554 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17555     for (int i = 0; i < 10; ++i)
17556       ;
17557   }
17558 #pragma omp target teams distribute parallel for simd
17559   for (int i = 0; i < 10; ++i) {
17560 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17561     for (int i = 0; i < 10; ++i)
17562       ;
17563   }
17564 #pragma omp target teams distribute parallel for simd
17565   for (int i = 0; i < 10; ++i) {
17566 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
17567     for (int i = 0; i < 10; ++i)
17568       ;
17569   }
17570 #pragma omp target teams distribute parallel for simd
17571   for (int i = 0; i < 10; ++i) {
17572 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17573     for (int i = 0; i < 10; ++i)
17574       ;
17575   }
17576 #pragma omp target teams distribute parallel for simd
17577   for (int i = 0; i < 10; ++i) {
17578 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17579     for (int i = 0; i < 10; ++i)
17580       ;
17581   }
17582 #pragma omp target teams distribute parallel for simd
17583   for (int i = 0; i < 10; ++i) {
17584 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17585     {
17586       bar();
17587     }
17588   }
17589 #pragma omp target teams distribute parallel for simd
17590   for (int i = 0; i < 10; ++i) {
17591 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17592     {
17593       bar();
17594     }
17595   }
17596 #pragma omp target teams distribute parallel for simd
17597   for (int i = 0; i < 10; ++i) {
17598 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17599     {
17600       bar();
17601     }
17602   }
17603 #pragma omp target teams distribute parallel for simd
17604   for (int i = 0; i < 10; ++i) {
17605 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17606     {
17607       bar();
17608     }
17609   }
17610 #pragma omp target teams distribute parallel for simd
17611   for (int i = 0; i < 10; ++i) {
17612 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17613     {
17614       bar();
17615     }
17616   }
17617 #pragma omp target teams distribute parallel for simd
17618   for (int i = 0; i < 10; ++i) {
17619 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17620     {
17621 #pragma omp single
17622       {
17623         bar();
17624       }
17625     }
17626   }
17627 #pragma omp target teams distribute parallel for simd
17628   for (int i = 0; i < 10; ++i) {
17629 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17630     for (int i = 0; i < 10; ++i)
17631       ;
17632   }
17633 #pragma omp target teams distribute parallel for simd
17634   for (int i = 0; i < 10; ++i) {
17635 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17636     for (int i = 0; i < 10; ++i)
17637       ;
17638   }
17639 #pragma omp target teams distribute parallel for simd
17640   for (int i = 0; i < 10; ++i) {
17641 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17642     {
17643       bar();
17644     }
17645   }
17646 #pragma omp target teams distribute parallel for simd
17647   for (int i = 0; i < 10; ++i) {
17648 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17649     {
17650       bar();
17651     }
17652   }
17653 #pragma omp target teams distribute parallel for simd
17654   for (int i = 0; i < 10; ++i) {
17655 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17656     bar();
17657   }
17658 #pragma omp target teams distribute parallel for simd
17659   for (int i = 0; i < 10; ++i) {
17660 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17661     bar();
17662   }
17663 #pragma omp target teams distribute parallel for simd
17664   for (int i = 0; i < 10; ++i) {
17665 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17666     bar();
17667   }
17668 #pragma omp target teams distribute parallel for simd
17669   for (int i = 0; i < 10; ++i) {
17670 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17671     bar();
17672   }
17673 #pragma omp target teams distribute parallel for simd
17674   for (int i = 0; i < 10; ++i) {
17675 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17676     bar();
17677   }
17678 #pragma omp target teams distribute parallel for simd
17679   for (int i = 0; i < 10; ++i) {
17680 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}OK
17681     ++a;
17682   }
17683 #pragma omp target teams distribute parallel for simd
17684   for (int i = 0; i < 10; ++i) {
17685 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17686     ++a;
17687   }
17688 #pragma omp target teams distribute parallel for simd
17689   for (int i = 0; i < 10; ++i) {
17690 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17691     ++a;
17692   }
17693 #pragma omp target teams distribute parallel for simd
17694   for (int i = 0; i < 10; ++i) {
17695 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17696     for (int i = 0; i < 10; ++i)
17697       ;
17698   }
17699 #pragma omp target teams distribute parallel for simd
17700   for (int i = 0; i < 10; ++i) {
17701 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17702     ++a;
17703   }
17704 #pragma omp target teams distribute parallel for simd
17705   for (int i = 0; i < 10; ++i) {
17706 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17707     ++a;
17708   }
17709 #pragma omp target teams distribute parallel for simd
17710   for (int i = 0; i < 10; ++i) {
17711 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17712     ++a;
17713   }
17714 #pragma omp target teams distribute parallel for simd
17715   for (int i = 0; i < 10; ++i) {
17716 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17717     ++a;
17718   }
17719 #pragma omp target teams distribute parallel for simd
17720   for (int i = 0; i < 10; ++i) {
17721 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17722     for (int i = 0; i < 10; ++i)
17723       ++a;
17724   }
17725 #pragma omp target teams distribute parallel for simd
17726   for (int i = 0; i < 10; ++i) {
17727 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17728     for (int i = 0; i < 10; ++i)
17729       ++a;
17730   }
17731 #pragma omp target teams distribute parallel for simd
17732   for (int i = 0; i < 10; ++i) {
17733 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17734     for (int i = 0; i < 10; ++i)
17735       ++a;
17736   }
17737 #pragma omp target teams distribute parallel for simd
17738   for (int i = 0; i < 10; ++i) {
17739 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17740     for (int i = 0; i < 10; ++i)
17741       ++a;
17742   }
17743 #pragma omp target teams distribute parallel for simd
17744   for (int i = 0; i < 10; ++i) {
17745 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17746     for (int i = 0; i < 10; ++i)
17747       ++a;
17748   }
17749 #pragma omp target teams distribute parallel for simd
17750   for (int i = 0; i < 10; ++i) {
17751 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17752     for (int i = 0; i < 10; ++i)
17753       ;
17754   }
17755 #pragma omp target teams distribute parallel for simd
17756   for (int i = 0; i < 10; ++i) {
17757 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17758     a++;
17759   }
17760 #pragma omp target teams distribute parallel for simd
17761   for (int i = 0; i < 10; ++i) {
17762 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17763     for (int i = 0; i < 10; ++i)
17764       ;
17765   }
17766 #pragma omp target teams distribute parallel for simd
17767   for (int i = 0; i < 10; ++i) {
17768 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17769     for (int i = 0; i < 10; ++i)
17770       ;
17771   }
17772 #pragma omp target teams distribute parallel for simd
17773   for (int i = 0; i < 10; ++i) {
17774 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17775     for (int i = 0; i < 10; ++i)
17776       ;
17777   }
17778 #pragma omp target teams distribute parallel for simd
17779   for (int i = 0; i < 10; ++i) {
17780 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17781     for (int i = 0; i < 10; ++i)
17782       ;
17783   }
17784 
17785 // TARGET TEAMS DISTRIBUTE SIMD DIRECTIVE
17786 #pragma omp target teams distribute simd // OK
17787   for (int i = 0; i < 10; ++i)
17788     ;
17789 #pragma omp target teams distribute simd
17790   for (int i = 0; i < 10; ++i) {
17791 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17792     for (int i = 0; i < 10; ++i)
17793       ;
17794   }
17795 #pragma omp target teams distribute simd
17796   for (int i = 0; i < 10; ++i) {
17797 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17798     for (int i = 0; i < 10; ++i)
17799       ;
17800   }
17801 #pragma omp target teams distribute simd
17802   for (int i = 0; i < 10; ++i) {
17803 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17804     for (int i = 0; i < 10; ++i)
17805       ;
17806   }
17807 #pragma omp target teams distribute simd
17808   for (int i = 0; i < 10; ++i) {
17809 #pragma omp simd // omp45warn-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
17810     for (int i = 0; i < 10; ++i)
17811       ;
17812   }
17813 #pragma omp target teams distribute simd
17814   for (int i = 0; i < 10; ++i) {
17815 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17816     for (int i = 0; i < 10; ++i)
17817       ;
17818   }
17819 #pragma omp target teams distribute simd
17820   for (int i = 0; i < 10; ++i) {
17821 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17822     for (int i = 0; i < 10; ++i)
17823       ;
17824   }
17825 #pragma omp target teams distribute simd
17826   for (int i = 0; i < 10; ++i) {
17827 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17828     {
17829       bar();
17830     }
17831   }
17832 #pragma omp target teams distribute simd
17833   for (int i = 0; i < 10; ++i) {
17834 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17835     {
17836       bar();
17837     }
17838   }
17839 #pragma omp target teams distribute simd
17840   for (int i = 0; i < 10; ++i) {
17841 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17842     {
17843       bar();
17844     }
17845   }
17846 #pragma omp target teams distribute simd
17847   for (int i = 0; i < 10; ++i) {
17848 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17849     {
17850       bar();
17851     }
17852   }
17853 #pragma omp target teams distribute simd
17854   for (int i = 0; i < 10; ++i) {
17855 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17856     {
17857       bar();
17858     }
17859   }
17860 #pragma omp target teams distribute simd
17861   for (int i = 0; i < 10; ++i) {
17862 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17863     {
17864 #pragma omp single
17865       {
17866         bar();
17867       }
17868     }
17869   }
17870 #pragma omp target teams distribute simd
17871   for (int i = 0; i < 10; ++i) {
17872 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17873     for (int i = 0; i < 10; ++i)
17874       ;
17875   }
17876 #pragma omp target teams distribute simd
17877   for (int i = 0; i < 10; ++i) {
17878 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17879     for (int i = 0; i < 10; ++i)
17880       ;
17881   }
17882 #pragma omp target teams distribute simd
17883   for (int i = 0; i < 10; ++i) {
17884 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17885     {
17886       bar();
17887     }
17888   }
17889 #pragma omp target teams distribute simd
17890   for (int i = 0; i < 10; ++i) {
17891 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17892     {
17893       bar();
17894     }
17895   }
17896 #pragma omp target teams distribute simd
17897   for (int i = 0; i < 10; ++i) {
17898 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17899     bar();
17900   }
17901 #pragma omp target teams distribute simd
17902   for (int i = 0; i < 10; ++i) {
17903 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17904     bar();
17905   }
17906 #pragma omp target teams distribute simd
17907   for (int i = 0; i < 10; ++i) {
17908 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17909     bar();
17910   }
17911 #pragma omp target teams distribute simd
17912   for (int i = 0; i < 10; ++i) {
17913 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17914     bar();
17915   }
17916 #pragma omp target teams distribute simd
17917   for (int i = 0; i < 10; ++i) {
17918 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17919     bar();
17920   }
17921 #pragma omp target teams distribute simd
17922   for (int i = 0; i < 10; ++i) {
17923 #pragma omp atomic // omp45-error {{OpenMP constructs may not be nested inside a simd region}}OK
17924     ++a;
17925   }
17926 #pragma omp target teams distribute simd
17927   for (int i = 0; i < 10; ++i) {
17928 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17929     ++a;
17930   }
17931 #pragma omp target teams distribute simd
17932   for (int i = 0; i < 10; ++i) {
17933 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17934     ++a;
17935   }
17936 #pragma omp target teams distribute simd
17937   for (int i = 0; i < 10; ++i) {
17938 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17939     for (int i = 0; i < 10; ++i)
17940       ;
17941   }
17942 #pragma omp target teams distribute simd
17943   for (int i = 0; i < 10; ++i) {
17944 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17945     ++a;
17946   }
17947 #pragma omp target teams distribute simd
17948   for (int i = 0; i < 10; ++i) {
17949 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17950     ++a;
17951   }
17952 #pragma omp target teams distribute simd
17953   for (int i = 0; i < 10; ++i) {
17954 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17955     ++a;
17956   }
17957 #pragma omp target teams distribute simd
17958   for (int i = 0; i < 10; ++i) {
17959 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17960     ++a;
17961   }
17962 #pragma omp target teams distribute simd
17963   for (int i = 0; i < 10; ++i) {
17964 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17965     for (int i = 0; i < 10; ++i)
17966       ++a;
17967   }
17968 #pragma omp target teams distribute simd
17969   for (int i = 0; i < 10; ++i) {
17970 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17971     for (int i = 0; i < 10; ++i)
17972       ++a;
17973   }
17974 #pragma omp target teams distribute simd
17975   for (int i = 0; i < 10; ++i) {
17976 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17977     for (int i = 0; i < 10; ++i)
17978       ++a;
17979   }
17980 #pragma omp target teams distribute simd
17981   for (int i = 0; i < 10; ++i) {
17982 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17983     for (int i = 0; i < 10; ++i)
17984       ++a;
17985   }
17986 #pragma omp target teams distribute simd
17987   for (int i = 0; i < 10; ++i) {
17988 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17989     for (int i = 0; i < 10; ++i)
17990       ++a;
17991   }
17992 #pragma omp target teams distribute simd
17993   for (int i = 0; i < 10; ++i) {
17994 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17995     for (int i = 0; i < 10; ++i)
17996       ;
17997   }
17998 #pragma omp target teams distribute simd
17999   for (int i = 0; i < 10; ++i) {
18000 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
18001     a++;
18002   }
18003 #pragma omp target teams distribute simd
18004   for (int i = 0; i < 10; ++i) {
18005 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
18006     for (int i = 0; i < 10; ++i)
18007       ;
18008   }
18009 #pragma omp target teams distribute simd
18010   for (int i = 0; i < 10; ++i) {
18011 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
18012     for (int i = 0; i < 10; ++i)
18013       ;
18014   }
18015 #pragma omp target teams distribute simd
18016   for (int i = 0; i < 10; ++i) {
18017 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
18018     for (int i = 0; i < 10; ++i)
18019       ;
18020   }
18021 #pragma omp target teams distribute simd
18022   for (int i = 0; i < 10; ++i) {
18023 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
18024     for (int i = 0; i < 10; ++i)
18025       ;
18026   }
18027 
18028   return foo<int>();
18029 }
18030 
18031