1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s
2 
3 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s
4 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
5 
6 void bar();
7 
8 template <class T>
foo()9 void foo() {
10   T a = T();
11 // PARALLEL DIRECTIVE
12 #pragma omp parallel
13 #pragma omp for
14   for (int i = 0; i < 10; ++i)
15     ;
16 #pragma omp parallel
17 #pragma omp simd
18   for (int i = 0; i < 10; ++i)
19     ;
20 #pragma omp parallel
21 #pragma omp for simd
22   for (int i = 0; i < 10; ++i)
23     ;
24 #pragma omp parallel
25 #pragma omp sections
26   {
27     bar();
28   }
29 #pragma omp parallel
30 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel region}}
31   {
32     bar();
33   }
34 #pragma omp parallel
35 #pragma omp single
36   bar();
37 
38 #pragma omp parallel
39 #pragma omp master
40   {
41     bar();
42   }
43 #pragma omp parallel
44 #pragma omp critical
45   {
46     bar();
47   }
48 #pragma omp parallel
49 #pragma omp parallel for
50   for (int i = 0; i < 10; ++i)
51     ;
52 #pragma omp parallel
53 #pragma omp parallel for simd
54   for (int i = 0; i < 10; ++i)
55     ;
56 #pragma omp parallel
57 #pragma omp parallel sections
58   {
59     bar();
60   }
61 #pragma omp parallel
62 #pragma omp task
63   {
64     bar();
65   }
66 #pragma omp parallel
67   {
68 #pragma omp taskyield
69     bar();
70   }
71 #pragma omp parallel
72   {
73 #pragma omp barrier
74     bar();
75   }
76 #pragma omp parallel
77   {
78 #pragma omp taskwait
79     bar();
80   }
81 #pragma omp parallel
82   {
83 #pragma omp flush
84     bar();
85   }
86 #pragma omp parallel
87   {
88 #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?}}
89     bar();
90   }
91 #pragma omp parallel
92   {
93 #pragma omp atomic
94     ++a;
95   }
96 #pragma omp parallel
97   {
98 #pragma omp target
99     ++a;
100   }
101 #pragma omp parallel
102   {
103 #pragma omp target parallel
104     ++a;
105   }
106 #pragma omp parallel
107   {
108 #pragma omp target parallel for
109   for (int i = 0; i < 10; ++i)
110     ;
111   }
112 #pragma omp parallel
113   {
114 #pragma omp target enter data map(to: a)
115     ++a;
116   }
117 #pragma omp parallel
118   {
119 #pragma omp target exit data map(from: a)
120     ++a;
121   }
122 #pragma omp parallel
123   {
124 #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?}}
125     ++a;
126   }
127 #pragma omp parallel
128   {
129 #pragma omp taskloop
130   for (int i = 0; i < 10; ++i)
131     ++a;
132   }
133 #pragma omp parallel
134   {
135 #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?}}
136     for (int i = 0; i < 10; ++i)
137       ;
138   }
139 #pragma omp parallel
140   {
141 #pragma omp target update to(a)
142   }
143 #pragma omp parallel
144   {
145 #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?}}
146     for (int i = 0; i < 10; ++i)
147       ;
148   }
149 #pragma omp parallel
150   {
151 #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?}}
152     for (int i = 0; i < 10; ++i)
153       ;
154   }
155 #pragma omp parallel
156   {
157 #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?}}
158     for (int i = 0; i < 10; ++i)
159       ;
160   }
161 #pragma omp parallel
162   {
163 #pragma omp target simd // OK
164     for (int i = 0; i < 10; ++i)
165       ;
166   }
167 #pragma omp parallel
168   {
169 #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?}}
170     for (int i = 0; i < 10; ++i)
171       ;
172   }
173 #pragma omp parallel
174   {
175 #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?}}
176     for (int i = 0; i < 10; ++i)
177       ;
178   }
179 #pragma omp parallel
180   {
181 #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?}}
182     for (int i = 0; i < 10; ++i)
183       ;
184   }
185 #pragma omp parallel
186   {
187 #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?}}
188     for (int i = 0; i < 10; ++i)
189       ;
190   }
191 #pragma omp parallel
192   {
193 #pragma omp target teams // OK
194     ++a;
195   }
196 #pragma omp parallel
197   {
198 #pragma omp target teams distribute // OK
199     for (int i = 0; i < 10; ++i)
200       ;
201   }
202 #pragma omp parallel
203   {
204 #pragma omp target teams distribute parallel for // OK
205     for (int i = 0; i < 10; ++i)
206       ;
207   }
208 #pragma omp parallel
209   {
210 #pragma omp target teams distribute parallel for simd // OK
211     for (int i = 0; i < 10; ++i)
212       ;
213   }
214 #pragma omp parallel
215   {
216 #pragma omp target teams distribute simd // OK
217     for (int i = 0; i < 10; ++i)
218       ;
219   }
220 
221 // SIMD DIRECTIVE
222 #pragma omp simd
223   for (int i = 0; i < 10; ++i) {
224 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
225     for (int i = 0; i < 10; ++i)
226       ;
227   }
228 #pragma omp simd
229   for (int i = 0; i < 10; ++i) {
230 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
231     for (int i = 0; i < 10; ++i)
232       ;
233   }
234 #pragma omp simd
235   for (int i = 0; i < 10; ++i) {
236 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
237     for (int i = 0; i < 10; ++i)
238       ;
239   }
240 #pragma omp simd
241   for (int i = 0; i < 10; ++i) {
242 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
243     for (int i = 0; i < 10; ++i)
244       ;
245   }
246 #pragma omp simd
247   for (int i = 0; i < 10; ++i) {
248 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
249     {
250       bar();
251     }
252   }
253 #pragma omp simd
254   for (int i = 0; i < 10; ++i) {
255 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
256     {
257       bar();
258     }
259   }
260 #pragma omp simd
261   for (int i = 0; i < 10; ++i) {
262 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
263     {
264       bar();
265     }
266   }
267 #pragma omp simd
268   for (int i = 0; i < 10; ++i) {
269 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
270     {
271       bar();
272     }
273   }
274 #pragma omp simd
275   for (int i = 0; i < 10; ++i) {
276 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
277     {
278       bar();
279     }
280   }
281 #pragma omp simd
282   for (int i = 0; i < 10; ++i) {
283 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
284     for (int i = 0; i < 10; ++i)
285       ;
286   }
287 #pragma omp simd
288   for (int i = 0; i < 10; ++i) {
289 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
290     for (int i = 0; i < 10; ++i)
291       ;
292   }
293 #pragma omp simd
294   for (int i = 0; i < 10; ++i) {
295 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
296     {
297       bar();
298     }
299   }
300 #pragma omp simd
301   for (int i = 0; i < 10; ++i) {
302 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
303     {
304       bar();
305     }
306   }
307 #pragma omp simd
308   for (int i = 0; i < 10; ++i) {
309 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
310     bar();
311   }
312 #pragma omp simd
313   for (int i = 0; i < 10; ++i) {
314 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
315     bar();
316   }
317 #pragma omp simd
318   for (int i = 0; i < 10; ++i) {
319 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
320     bar();
321   }
322 #pragma omp simd
323   for (int i = 0; i < 10; ++i) {
324 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
325     bar();
326   }
327 #pragma omp simd
328   for (int i = 0; i < 10; ++i) {
329 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
330     bar();
331   }
332 #pragma omp simd
333   for (int i = 0; i < 10; ++i) {
334 #pragma omp ordered simd // OK
335     bar();
336   }
337 #pragma omp simd
338   for (int i = 0; i < 10; ++i) {
339 #pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
340     bar();
341   }
342 #pragma omp simd
343   for (int i = 0; i < 10; ++i) {
344 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
345     ++a;
346   }
347 #pragma omp simd
348   for (int i = 0; i < 10; ++i) {
349 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
350     ++a;
351   }
352 #pragma omp simd
353   for (int i = 0; i < 10; ++i) {
354 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
355     ++a;
356   }
357 #pragma omp simd
358   for (int i = 0; i < 10; ++i) {
359 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
360     for (int i = 0; i < 10; ++i)
361       ;
362   }
363 #pragma omp simd
364   for (int i = 0; i < 10; ++i) {
365 #pragma omp target enter data map(to: a) // 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 exit data map(from: a) // 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 teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
376     ++a;
377   }
378 #pragma omp simd
379   for (int i = 0; i < 10; ++i) {
380 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
381   for (int i = 0; i < 10; ++i)
382     ++a;
383   }
384 #pragma omp simd
385   for (int i = 0; i < 10; ++i) {
386 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
387     for (int j = 0; j < 10; ++j)
388       ;
389   }
390 #pragma omp simd
391   for (int i = 0; i < 10; ++i) {
392 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
393   }
394 #pragma omp simd
395   for (int i = 0; i < 10; ++i) {
396 #pragma omp distribute parallel for// expected-error {{OpenMP constructs may not be nested inside a simd region}}
397     for (int j = 0; j < 10; ++j)
398       ;
399   }
400 #pragma omp simd
401   for (int i = 0; i < 10; ++i) {
402 #pragma omp distribute parallel for simd // 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 distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
409     for (int j = 0; j < 10; ++j)
410       ;
411   }
412 #pragma omp simd
413   for (int i = 0; i < 10; ++i) {
414 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
415     for (int j = 0; j < 10; ++j)
416       ;
417   }
418 #pragma omp simd
419   for (int i = 0; i < 10; ++i) {
420 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
421     for (int j = 0; j < 10; ++j)
422       ;
423   }
424 #pragma omp simd
425   for (int i = 0; i < 10; ++i) {
426 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
427     for (int j = 0; j < 10; ++j)
428       ;
429   }
430 #pragma omp simd
431   for (int i = 0; i < 10; ++i) {
432 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
433     for (int j = 0; j < 10; ++j)
434       ;
435   }
436 #pragma omp simd
437   for (int i = 0; i < 10; ++i) {
438 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
439     for (int j = 0; j < 10; ++j)
440       ;
441   }
442 #pragma omp simd
443   for (int i = 0; i < 10; ++i) {
444 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
445     ++a;
446   }
447 #pragma omp simd
448   for (int i = 0; i < 10; ++i) {
449 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
450     for (int j = 0; j < 10; ++j)
451       ;
452   }
453 #pragma omp simd
454   for (int i = 0; i < 10; ++i) {
455 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
456     for (int j = 0; j < 10; ++j)
457       ;
458   }
459 #pragma omp simd
460   for (int i = 0; i < 10; ++i) {
461 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
462     for (int j = 0; j < 10; ++j)
463       ;
464   }
465 #pragma omp simd
466   for (int i = 0; i < 10; ++i) {
467 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
468     for (int j = 0; j < 10; ++j)
469       ;
470   }
471 
472 // FOR DIRECTIVE
473 #pragma omp for
474   for (int i = 0; i < 10; ++i) {
475 #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?}}
476     for (int i = 0; i < 10; ++i)
477       ;
478   }
479 #pragma omp for
480   for (int i = 0; i < 10; ++i) {
481 #pragma omp simd
482     for (int i = 0; i < 10; ++i)
483       ;
484   }
485 #pragma omp for
486   for (int i = 0; i < 10; ++i) {
487 #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?}}
488     for (int i = 0; i < 10; ++i)
489       ;
490   }
491 #pragma omp for
492   for (int i = 0; i < 10; ++i) {
493 #pragma omp parallel
494     for (int i = 0; i < 10; ++i)
495       ;
496   }
497 #pragma omp for
498   for (int i = 0; i < 10; ++i) {
499 #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?}}
500     {
501       bar();
502     }
503   }
504 #pragma omp for
505   for (int i = 0; i < 10; ++i) {
506 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a for region}}
507     {
508       bar();
509     }
510   }
511 #pragma omp for
512   for (int i = 0; i < 10; ++i) {
513 #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?}}
514     {
515       bar();
516     }
517   }
518 
519 #pragma omp for
520   for (int i = 0; i < 10; ++i) {
521 #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
522     {
523       bar();
524     }
525   }
526 #pragma omp for
527   for (int i = 0; i < 10; ++i) {
528 #pragma omp critical
529     {
530       bar();
531     }
532   }
533 #pragma omp for
534   for (int i = 0; i < 10; ++i) {
535 #pragma omp parallel
536     {
537 #pragma omp single // OK
538       {
539         bar();
540       }
541 #pragma omp for // OK
542       for (int i = 0; i < 10; ++i)
543         ;
544 #pragma omp sections // OK
545       {
546         bar();
547       }
548     }
549   }
550 #pragma omp for
551   for (int i = 0; i < 10; ++i) {
552 #pragma omp parallel for
553     for (int i = 0; i < 10; ++i)
554       ;
555   }
556 #pragma omp for
557   for (int i = 0; i < 10; ++i) {
558 #pragma omp parallel for simd
559     for (int i = 0; i < 10; ++i)
560       ;
561   }
562 #pragma omp for
563   for (int i = 0; i < 10; ++i) {
564 #pragma omp parallel sections
565     {
566       bar();
567     }
568   }
569 #pragma omp for
570   for (int i = 0; i < 10; ++i) {
571 #pragma omp task
572     {
573       bar();
574     }
575   }
576 #pragma omp for
577   for (int i = 0; i < 10; ++i) {
578 #pragma omp taskyield
579     bar();
580   }
581 #pragma omp for
582   for (int i = 0; i < 10; ++i) {
583 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}}
584     bar();
585   }
586 #pragma omp for
587   for (int i = 0; i < 10; ++i) {
588 #pragma omp taskwait
589     bar();
590   }
591 #pragma omp for
592   for (int i = 0; i < 10; ++i) {
593 #pragma omp flush
594     bar();
595   }
596 #pragma omp for
597   for (int i = 0; i < 10; ++i) {
598 #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?}}
599     bar();
600   }
601 #pragma omp for ordered
602   for (int i = 0; i < 10; ++i) {
603 #pragma omp ordered // OK
604     bar();
605   }
606 #pragma omp for
607   for (int i = 0; i < 10; ++i) {
608 #pragma omp atomic
609     ++a;
610   }
611 #pragma omp for
612   for (int i = 0; i < 10; ++i) {
613 #pragma omp target
614     ++a;
615   }
616 #pragma omp for
617   for (int i = 0; i < 10; ++i) {
618 #pragma omp target parallel
619     ++a;
620   }
621 #pragma omp for
622   for (int i = 0; i < 10; ++i) {
623 #pragma omp target parallel for
624     for (int i = 0; i < 10; ++i)
625       ;
626   }
627 #pragma omp for
628   for (int i = 0; i < 10; ++i) {
629 #pragma omp target enter data map(to: a)
630     ++a;
631   }
632 #pragma omp for
633   for (int i = 0; i < 10; ++i) {
634 #pragma omp target exit data map(from: a)
635     ++a;
636   }
637 #pragma omp for
638   for (int i = 0; i < 10; ++i) {
639 #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?}}
640     ++a;
641   }
642 #pragma omp for
643   for (int i = 0; i < 10; ++i) {
644 #pragma omp taskloop
645   for (int i = 0; i < 10; ++i)
646     ++a;
647   }
648 #pragma omp for
649   for (int i = 0; i < 10; ++i) {
650 #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?}}
651     for (int j = 0; j < 10; ++j)
652       ;
653   }
654 #pragma omp for
655   for (int i = 0; i < 10; ++i) {
656 #pragma omp target update to(a)
657   }
658 #pragma omp for
659   for (int i = 0; i < 10; ++i) {
660 #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?}}
661     for (int j = 0; j < 10; ++j)
662       ;
663   }
664 #pragma omp for
665   for (int i = 0; i < 10; ++i) {
666 #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?}}
667     for (int j = 0; j < 10; ++j)
668       ;
669   }
670 #pragma omp for
671   for (int i = 0; i < 10; ++i) {
672 #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?}}
673     for (int j = 0; j < 10; ++j)
674       ;
675   }
676 #pragma omp for
677   for (int i = 0; i < 10; ++i) {
678 #pragma omp target simd // OK
679     for (int j = 0; j < 10; ++j)
680       ;
681   }
682 #pragma omp for
683   for (int i = 0; i < 10; ++i) {
684 #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?}}
685     for (int j = 0; j < 10; ++j)
686       ;
687   }
688 #pragma omp for
689   for (int i = 0; i < 10; ++i) {
690 #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?}}
691     for (int j = 0; j < 10; ++j)
692       ;
693   }
694 #pragma omp for
695   for (int i = 0; i < 10; ++i) {
696 #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?}}
697     for (int j = 0; j < 10; ++j)
698       ;
699   }
700 #pragma omp for
701   for (int i = 0; i < 10; ++i) {
702 #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?}}
703     for (int j = 0; j < 10; ++j)
704       ;
705   }
706 #pragma omp for
707   for (int i = 0; i < 10; ++i) {
708 #pragma omp target teams // OK
709     ++a;
710   }
711 #pragma omp for
712   for (int i = 0; i < 10; ++i) {
713 #pragma omp target teams distribute // OK
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 target teams distribute parallel for // OK
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 target teams distribute parallel for simd // OK
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 distribute simd // OK
732     for (int j = 0; j < 10; ++j)
733       ;
734   }
735 
736 // FOR SIMD DIRECTIVE
737 #pragma omp for simd
738   for (int i = 0; i < 10; ++i) {
739 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
740     for (int i = 0; i < 10; ++i)
741       ;
742   }
743 #pragma omp for simd
744   for (int i = 0; i < 10; ++i) {
745 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
746     for (int i = 0; i < 10; ++i)
747       ;
748   }
749 #pragma omp for simd
750   for (int i = 0; i < 10; ++i) {
751 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
752     for (int i = 0; i < 10; ++i)
753       ;
754   }
755 #pragma omp for simd
756   for (int i = 0; i < 10; ++i) {
757 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
758     for (int i = 0; i < 10; ++i)
759       ;
760   }
761 #pragma omp for simd
762   for (int i = 0; i < 10; ++i) {
763 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
764     {
765       bar();
766     }
767   }
768 #pragma omp for simd
769   for (int i = 0; i < 10; ++i) {
770 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
771     {
772       bar();
773     }
774   }
775 #pragma omp for simd
776   for (int i = 0; i < 10; ++i) {
777 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
778     {
779       bar();
780     }
781   }
782 #pragma omp for simd
783   for (int i = 0; i < 10; ++i) {
784 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
785     {
786       bar();
787     }
788   }
789 #pragma omp for simd
790   for (int i = 0; i < 10; ++i) {
791 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
792     {
793       bar();
794     }
795   }
796 #pragma omp for simd
797   for (int i = 0; i < 10; ++i) {
798 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
799     for (int i = 0; i < 10; ++i)
800       ;
801   }
802 #pragma omp for simd
803   for (int i = 0; i < 10; ++i) {
804 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
805     for (int i = 0; i < 10; ++i)
806       ;
807   }
808 #pragma omp for simd
809   for (int i = 0; i < 10; ++i) {
810 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
811     {
812       bar();
813     }
814   }
815 #pragma omp for simd
816   for (int i = 0; i < 10; ++i) {
817 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
818     {
819       bar();
820     }
821   }
822 #pragma omp for simd
823   for (int i = 0; i < 10; ++i) {
824 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
825     bar();
826   }
827 #pragma omp for simd
828   for (int i = 0; i < 10; ++i) {
829 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
830     bar();
831   }
832 #pragma omp for simd
833   for (int i = 0; i < 10; ++i) {
834 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
835     bar();
836   }
837 #pragma omp for simd
838   for (int i = 0; i < 10; ++i) {
839 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
840     bar();
841   }
842 #pragma omp for simd
843   for (int i = 0; i < 10; ++i) {
844 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
845     bar();
846   }
847 #pragma omp for simd
848   for (int i = 0; i < 10; ++i) {
849 #pragma omp ordered simd // OK
850     bar();
851   }
852 #pragma omp for simd
853   for (int i = 0; i < 10; ++i) {
854 #pragma omp ordered threads // 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 atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
860     ++a;
861   }
862 #pragma omp for simd
863   for (int i = 0; i < 10; ++i) {
864 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
865     ++a;
866   }
867 #pragma omp for simd
868   for (int i = 0; i < 10; ++i) {
869 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
870     ++a;
871   }
872 #pragma omp for simd
873   for (int i = 0; i < 10; ++i) {
874 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
875     for (int i = 0; i < 10; ++i)
876       ;
877   }
878 #pragma omp for simd
879   for (int i = 0; i < 10; ++i) {
880 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
881     ++a;
882   }
883 #pragma omp for simd
884   for (int i = 0; i < 10; ++i) {
885 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
886     ++a;
887   }
888 #pragma omp for simd
889   for (int i = 0; i < 10; ++i) {
890 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
891     ++a;
892   }
893 #pragma omp for simd
894   for (int i = 0; i < 10; ++i) {
895 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
896   for (int i = 0; i < 10; ++i)
897     ++a;
898   }
899 #pragma omp for simd
900   for (int i = 0; i < 10; ++i) {
901 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
902     for (int j = 0; j < 10; ++j)
903       ;
904   }
905 #pragma omp for simd
906   for (int i = 0; i < 10; ++i) {
907 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
908     bar();
909   }
910 #pragma omp for simd
911   for (int i = 0; i < 10; ++i) {
912 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
913     for (int j = 0; j < 10; ++j)
914       ;
915   }
916 #pragma omp for simd
917   for (int i = 0; i < 10; ++i) {
918 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
919     for (int j = 0; j < 10; ++j)
920       ;
921   }
922 #pragma omp for simd
923   for (int i = 0; i < 10; ++i) {
924 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
925     for (int j = 0; j < 10; ++j)
926       ;
927   }
928 #pragma omp for simd
929   for (int i = 0; i < 10; ++i) {
930 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
931     for (int j = 0; j < 10; ++j)
932       ;
933   }
934 #pragma omp for simd
935   for (int i = 0; i < 10; ++i) {
936 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
937     for (int j = 0; j < 10; ++j)
938       ;
939   }
940 #pragma omp for simd
941   for (int i = 0; i < 10; ++i) {
942 #pragma omp teams distribute simd // 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 teams 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 teams distribute parallel for // 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 teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
961     a++;
962   }
963 #pragma omp for simd
964   for (int i = 0; i < 10; ++i) {
965 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
966     for (int j = 0; j < 10; ++j)
967       ;
968   }
969 #pragma omp for simd
970   for (int i = 0; i < 10; ++i) {
971 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
972     for (int j = 0; j < 10; ++j)
973       ;
974   }
975 #pragma omp for simd
976   for (int i = 0; i < 10; ++i) {
977 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
978     for (int j = 0; j < 10; ++j)
979       ;
980   }
981 #pragma omp for simd
982   for (int i = 0; i < 10; ++i) {
983 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
984     for (int j = 0; j < 10; ++j)
985       ;
986   }
987 
988 // SECTIONS DIRECTIVE
989 #pragma omp sections
990   {
991 #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?}}
992     for (int i = 0; i < 10; ++i)
993       ;
994   }
995 #pragma omp sections
996   {
997 #pragma omp simd
998     for (int i = 0; i < 10; ++i)
999       ;
1000   }
1001 #pragma omp sections
1002   {
1003 #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?}}
1004     for (int i = 0; i < 10; ++i)
1005       ;
1006   }
1007 #pragma omp sections
1008   {
1009 #pragma omp parallel
1010     for (int i = 0; i < 10; ++i)
1011       ;
1012   }
1013 #pragma omp sections
1014   {
1015 #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?}}
1016     {
1017       bar();
1018     }
1019   }
1020 #pragma omp sections
1021   {
1022 #pragma omp section
1023     {
1024       bar();
1025     }
1026   }
1027 #pragma omp sections
1028   {
1029 #pragma omp parallel
1030     {
1031 #pragma omp single // OK
1032       {
1033         bar();
1034       }
1035 #pragma omp for // OK
1036       for (int i = 0; i < 10; ++i)
1037         ;
1038 #pragma omp sections // OK
1039       {
1040         bar();
1041       }
1042     }
1043   }
1044 #pragma omp sections
1045   {
1046 #pragma omp parallel
1047     {
1048 #pragma omp master // OK
1049       {
1050         bar();
1051       }
1052 #pragma omp for // OK
1053       for (int i = 0; i < 10; ++i)
1054         ;
1055 #pragma omp master // OK
1056       {
1057         bar();
1058       }
1059     }
1060 #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}}
1061     bar();
1062   }
1063 #pragma omp sections
1064   {
1065 #pragma omp parallel
1066     {
1067 #pragma omp critical(A) // OK
1068       {
1069         bar();
1070       }
1071 #pragma omp for // OK
1072       for (int i = 0; i < 10; ++i)
1073         ;
1074 #pragma omp critical // OK
1075       {
1076         bar();
1077       }
1078     }
1079 #pragma omp critical(A) // expected-error {{statement in 'omp sections' directive must be enclosed into a section region}}
1080     bar();
1081   }
1082 #pragma omp sections
1083   {
1084 #pragma omp parallel for
1085     for (int i = 0; i < 10; ++i)
1086       ;
1087   }
1088 #pragma omp sections
1089   {
1090 #pragma omp parallel for simd
1091     for (int i = 0; i < 10; ++i)
1092       ;
1093   }
1094 #pragma omp sections
1095   {
1096 #pragma omp parallel sections
1097     {
1098       bar();
1099     }
1100   }
1101 #pragma omp sections
1102   {
1103 #pragma omp task
1104     {
1105       bar();
1106     }
1107   }
1108 #pragma omp sections
1109   {
1110 #pragma omp taskyield
1111   }
1112 #pragma omp sections
1113   {
1114 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}}
1115   }
1116 #pragma omp sections
1117   {
1118 #pragma omp taskwait
1119   }
1120 #pragma omp sections
1121   {
1122 #pragma omp flush
1123   }
1124 #pragma omp sections
1125   {
1126 #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?}}
1127     bar();
1128   }
1129 #pragma omp sections
1130   {
1131 #pragma omp atomic
1132     ++a;
1133   }
1134 #pragma omp sections
1135   {
1136 #pragma omp target
1137     ++a;
1138   }
1139 #pragma omp sections
1140   {
1141 #pragma omp target parallel
1142     ++a;
1143   }
1144 #pragma omp sections
1145   {
1146 #pragma omp target parallel for
1147     for (int i = 0; i < 10; ++i)
1148       ;
1149   }
1150 #pragma omp sections
1151   {
1152 #pragma omp target enter data map(to: a)
1153   }
1154 #pragma omp sections
1155   {
1156 #pragma omp target exit data map(from: a)
1157   }
1158 #pragma omp sections
1159   {
1160 #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?}}
1161     ++a;
1162   }
1163 #pragma omp sections
1164   {
1165 #pragma omp taskloop
1166   for (int i = 0; i < 10; ++i)
1167     ++a;
1168   }
1169 #pragma omp sections
1170   {
1171 #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?}}
1172     for (int i = 0; i < 10; ++i)
1173       ;
1174   }
1175 #pragma omp sections
1176   {
1177 #pragma omp target update to(a)
1178   }
1179 #pragma omp sections
1180   {
1181 #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?}}
1182     for (int i = 0; i < 10; ++i)
1183       ;
1184   }
1185 #pragma omp sections
1186   {
1187 #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?}}
1188     for (int i = 0; i < 10; ++i)
1189       ;
1190   }
1191 #pragma omp sections
1192   {
1193 #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?}}
1194     for (int i = 0; i < 10; ++i)
1195       ;
1196   }
1197 #pragma omp sections
1198   {
1199 #pragma omp target simd // OK
1200     for (int i = 0; i < 10; ++i)
1201       ;
1202   }
1203 #pragma omp sections
1204   {
1205 #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?}}
1206     for (int i = 0; i < 10; ++i)
1207       ;
1208   }
1209 #pragma omp sections
1210   {
1211 #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?}}
1212     for (int i = 0; i < 10; ++i)
1213       ;
1214   }
1215 #pragma omp sections
1216   {
1217 #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?}}
1218     for (int i = 0; i < 10; ++i)
1219       ;
1220   }
1221 #pragma omp sections
1222   {
1223 #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?}}
1224     for (int i = 0; i < 10; ++i)
1225       ;
1226   }
1227 #pragma omp sections
1228   {
1229 #pragma omp target teams // OK
1230     ++a;
1231   }
1232 #pragma omp sections
1233   {
1234 #pragma omp target teams distribute // OK
1235     for (int i = 0; i < 10; ++i)
1236       ;
1237   }
1238 #pragma omp sections
1239   {
1240 #pragma omp target teams distribute parallel for // OK
1241     for (int i = 0; i < 10; ++i)
1242       ;
1243   }
1244 #pragma omp sections
1245   {
1246 #pragma omp target teams distribute parallel for simd // OK
1247     for (int i = 0; i < 10; ++i)
1248       ;
1249   }
1250 #pragma omp sections
1251   {
1252 #pragma omp target teams distribute simd // OK
1253     for (int i = 0; i < 10; ++i)
1254       ;
1255   }
1256 
1257 // SECTION DIRECTIVE
1258 #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
1259   {
1260     bar();
1261   }
1262 #pragma omp sections
1263   {
1264 #pragma omp section
1265     {
1266 #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?}}
1267       for (int i = 0; i < 10; ++i)
1268         ;
1269     }
1270   }
1271 #pragma omp sections
1272   {
1273 #pragma omp section
1274     {
1275 #pragma omp simd
1276       for (int i = 0; i < 10; ++i)
1277         ;
1278     }
1279   }
1280 #pragma omp sections
1281   {
1282 #pragma omp section
1283     {
1284 #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?}}
1285       for (int i = 0; i < 10; ++i)
1286         ;
1287     }
1288   }
1289 #pragma omp sections
1290   {
1291 #pragma omp section
1292     {
1293 #pragma omp parallel
1294       for (int i = 0; i < 10; ++i)
1295         ;
1296     }
1297   }
1298 #pragma omp sections
1299   {
1300 #pragma omp section
1301     {
1302 #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?}}
1303       {
1304         bar();
1305       }
1306     }
1307   }
1308 #pragma omp sections
1309   {
1310 #pragma omp section
1311     {
1312 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a section region}}
1313       {
1314         bar();
1315       }
1316     }
1317   }
1318 #pragma omp sections
1319   {
1320 #pragma omp section
1321     {
1322 #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?}}
1323       bar();
1324 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
1325       bar();
1326 #pragma omp critical
1327       bar();
1328     }
1329   }
1330 #pragma omp sections
1331   {
1332 #pragma omp section
1333     {
1334 #pragma omp parallel
1335       {
1336 #pragma omp single // OK
1337         {
1338           bar();
1339         }
1340 #pragma omp for // OK
1341         for (int i = 0; i < 10; ++i)
1342           ;
1343 #pragma omp for simd // OK
1344         for (int i = 0; i < 10; ++i)
1345           ;
1346 #pragma omp sections // OK
1347         {
1348           bar();
1349         }
1350       }
1351     }
1352   }
1353 #pragma omp sections
1354   {
1355 #pragma omp section
1356     {
1357 #pragma omp parallel for
1358       for (int i = 0; i < 10; ++i)
1359         ;
1360     }
1361   }
1362 #pragma omp sections
1363   {
1364 #pragma omp section
1365     {
1366 #pragma omp parallel for simd
1367       for (int i = 0; i < 10; ++i)
1368         ;
1369     }
1370   }
1371 #pragma omp sections
1372   {
1373 #pragma omp section
1374     {
1375 #pragma omp parallel sections
1376       {
1377         bar();
1378       }
1379     }
1380   }
1381 #pragma omp sections
1382   {
1383 #pragma omp section
1384     {
1385 #pragma omp task
1386       {
1387         bar();
1388       }
1389     }
1390   }
1391 #pragma omp sections
1392   {
1393 #pragma omp section
1394     {
1395 #pragma omp taskyield
1396       bar();
1397     }
1398   }
1399 #pragma omp sections
1400   {
1401 #pragma omp section
1402     {
1403 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'section' region}}
1404       bar();
1405     }
1406   }
1407 #pragma omp sections
1408   {
1409 #pragma omp section
1410     {
1411 #pragma omp taskwait
1412       bar();
1413     }
1414   }
1415 #pragma omp sections
1416   {
1417 #pragma omp section
1418     {
1419 #pragma omp flush
1420       bar();
1421     }
1422   }
1423 #pragma omp sections
1424   {
1425 #pragma omp section
1426     {
1427 #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?}}
1428       bar();
1429     }
1430   }
1431 #pragma omp sections
1432   {
1433 #pragma omp section
1434 #pragma omp atomic
1435     ++a;
1436   }
1437 #pragma omp sections
1438   {
1439 #pragma omp section
1440 #pragma omp target
1441     ++a;
1442   }
1443 #pragma omp sections
1444   {
1445 #pragma omp section
1446 #pragma omp target parallel
1447     ++a;
1448   }
1449 #pragma omp sections
1450   {
1451 #pragma omp section
1452     {
1453 #pragma omp target parallel for
1454       for (int i = 0; i < 10; ++i)
1455         ;
1456     }
1457   }
1458 #pragma omp sections
1459   {
1460 #pragma omp section
1461     {
1462 #pragma omp target enter data map(to: a)
1463       ++a;
1464     }
1465   }
1466 #pragma omp sections
1467   {
1468 #pragma omp section
1469     {
1470 #pragma omp target exit data map(from: a)
1471       ++a;
1472     }
1473   }
1474 #pragma omp sections
1475   {
1476 #pragma omp section
1477 #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?}}
1478     ++a;
1479   }
1480 #pragma omp sections
1481   {
1482 #pragma omp section
1483 #pragma omp taskloop
1484   for (int i = 0; i < 10; ++i)
1485     ++a;
1486   }
1487 #pragma omp sections
1488   {
1489 #pragma omp section
1490 #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?}}
1491     for (int i = 0; i < 10; ++i)
1492       ;
1493   }
1494 #pragma omp sections
1495   {
1496 #pragma omp section
1497     {
1498       bar();
1499 #pragma omp target update to(a)
1500     }
1501   }
1502 #pragma omp sections
1503   {
1504 #pragma omp section
1505 #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?}}
1506     for (int i = 0; i < 10; ++i)
1507       ;
1508   }
1509 #pragma omp sections
1510   {
1511 #pragma omp section
1512 #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?}}
1513     for (int i = 0; i < 10; ++i)
1514       ;
1515   }
1516 #pragma omp sections
1517   {
1518 #pragma omp section
1519 #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?}}
1520     for (int i = 0; i < 10; ++i)
1521       ;
1522   }
1523 #pragma omp sections
1524   {
1525 #pragma omp section
1526 #pragma omp target simd // OK
1527     for (int i = 0; i < 10; ++i)
1528       ;
1529   }
1530 #pragma omp sections
1531   {
1532 #pragma omp section
1533 #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?}}
1534     for (int i = 0; i < 10; ++i)
1535       ;
1536   }
1537 #pragma omp sections
1538   {
1539 #pragma omp section
1540 #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?}}
1541     for (int i = 0; i < 10; ++i)
1542       ;
1543   }
1544 #pragma omp sections
1545   {
1546 #pragma omp section
1547 #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?}}
1548     for (int i = 0; i < 10; ++i)
1549       ;
1550   }
1551 #pragma omp sections
1552   {
1553 #pragma omp section
1554 #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?}}
1555     for (int i = 0; i < 10; ++i)
1556       ;
1557   }
1558 #pragma omp sections
1559   {
1560 #pragma omp section
1561 #pragma omp target teams // OK
1562     ++a;
1563   }
1564 #pragma omp sections
1565   {
1566 #pragma omp section
1567 #pragma omp target teams distribute // OK
1568     for (int i = 0; i < 10; ++i)
1569       ;
1570   }
1571 #pragma omp sections
1572   {
1573 #pragma omp section
1574 #pragma omp target teams distribute parallel for // OK
1575     for (int i = 0; i < 10; ++i)
1576       ;
1577   }
1578 #pragma omp sections
1579   {
1580 #pragma omp section
1581 #pragma omp target teams distribute parallel for simd // OK
1582     for (int i = 0; i < 10; ++i)
1583       ;
1584   }
1585 #pragma omp sections
1586   {
1587 #pragma omp section
1588 #pragma omp target teams distribute simd // OK
1589     for (int i = 0; i < 10; ++i)
1590       ;
1591   }
1592 
1593 // SINGLE DIRECTIVE
1594 #pragma omp single
1595   {
1596 #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?}}
1597     for (int i = 0; i < 10; ++i)
1598       ;
1599   }
1600 #pragma omp single
1601   {
1602 #pragma omp simd
1603     for (int i = 0; i < 10; ++i)
1604       ;
1605   }
1606 #pragma omp single
1607   {
1608 #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?}}
1609     for (int i = 0; i < 10; ++i)
1610       ;
1611   }
1612 #pragma omp single
1613   {
1614 #pragma omp parallel
1615     for (int i = 0; i < 10; ++i)
1616       ;
1617   }
1618 #pragma omp single
1619   {
1620 #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?}}
1621     {
1622       bar();
1623     }
1624   }
1625 #pragma omp single
1626   {
1627 #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}}
1628     {
1629       bar();
1630     }
1631   }
1632 #pragma omp single
1633   {
1634 #pragma omp critical
1635     {
1636       bar();
1637     }
1638   }
1639 #pragma omp single
1640   {
1641 #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?}}
1642     {
1643       bar();
1644     }
1645   }
1646 #pragma omp single
1647   {
1648 #pragma omp parallel
1649     {
1650 #pragma omp single // OK
1651       {
1652         bar();
1653       }
1654 #pragma omp for // OK
1655       for (int i = 0; i < 10; ++i)
1656         ;
1657 #pragma omp for simd // OK
1658       for (int i = 0; i < 10; ++i)
1659         ;
1660 #pragma omp sections // OK
1661       {
1662         bar();
1663       }
1664     }
1665   }
1666 #pragma omp single
1667   {
1668 #pragma omp parallel for
1669     for (int i = 0; i < 10; ++i)
1670       ;
1671   }
1672 #pragma omp single
1673   {
1674 #pragma omp parallel for simd
1675     for (int i = 0; i < 10; ++i)
1676       ;
1677   }
1678 #pragma omp single
1679   {
1680 #pragma omp parallel sections
1681     {
1682       bar();
1683     }
1684   }
1685 #pragma omp single
1686   {
1687 #pragma omp task
1688     {
1689       bar();
1690     }
1691   }
1692 #pragma omp single
1693   {
1694 #pragma omp taskyield
1695     bar();
1696   }
1697 #pragma omp single
1698   {
1699 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}}
1700     bar();
1701   }
1702 #pragma omp single
1703   {
1704 #pragma omp taskwait
1705     bar();
1706   }
1707 #pragma omp single
1708   {
1709 #pragma omp flush
1710     bar();
1711   }
1712 #pragma omp single
1713   {
1714 #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?}}
1715     bar();
1716   }
1717 #pragma omp single
1718   {
1719 #pragma omp atomic
1720     ++a;
1721   }
1722 #pragma omp single
1723   {
1724 #pragma omp target
1725     ++a;
1726   }
1727 #pragma omp single
1728   {
1729 #pragma omp target parallel
1730     ++a;
1731   }
1732 #pragma omp single
1733   {
1734 #pragma omp target parallel for
1735     for (int i = 0; i < 10; ++i)
1736       ;
1737   }
1738 #pragma omp single
1739   {
1740 #pragma omp target enter data map(to: a)
1741     ++a;
1742   }
1743 #pragma omp single
1744   {
1745 #pragma omp target exit data map(from: a)
1746     ++a;
1747   }
1748 #pragma omp single
1749   {
1750 #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?}}
1751     ++a;
1752   }
1753 #pragma omp single
1754   {
1755 #pragma omp taskloop
1756   for (int i = 0; i < 10; ++i)
1757     ++a;
1758   }
1759 #pragma omp single
1760   {
1761 #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?}}
1762     for (int i = 0; i < 10; ++i)
1763       ;
1764   }
1765 #pragma omp single
1766   {
1767 #pragma omp target update to(a)
1768     bar();
1769   }
1770 #pragma omp single
1771   {
1772 #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?}}
1773     for (int i = 0; i < 10; ++i)
1774       ;
1775   }
1776 #pragma omp single
1777   {
1778 #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?}}
1779     for (int i = 0; i < 10; ++i)
1780       ;
1781   }
1782 #pragma omp single
1783   {
1784 #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?}}
1785     for (int i = 0; i < 10; ++i)
1786       ;
1787   }
1788 #pragma omp single
1789   {
1790 #pragma omp target simd // OK
1791     for (int i = 0; i < 10; ++i)
1792       ;
1793   }
1794 #pragma omp single
1795   {
1796 #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?}}
1797     for (int i = 0; i < 10; ++i)
1798       ;
1799   }
1800 #pragma omp single
1801   {
1802 #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?}}
1803     for (int i = 0; i < 10; ++i)
1804       ;
1805   }
1806 #pragma omp single
1807   {
1808 #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?}}
1809     for (int i = 0; i < 10; ++i)
1810       ;
1811   }
1812 #pragma omp single
1813   {
1814 #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?}}
1815     for (int i = 0; i < 10; ++i)
1816       ;
1817   }
1818 #pragma omp single
1819   {
1820 #pragma omp target teams // OK
1821     ++a;
1822   }
1823 #pragma omp single
1824   {
1825 #pragma omp target teams distribute // OK
1826     for (int i = 0; i < 10; ++i)
1827       ;
1828   }
1829 #pragma omp single
1830   {
1831 #pragma omp target teams distribute parallel for // OK
1832     for (int i = 0; i < 10; ++i)
1833       ;
1834   }
1835 #pragma omp single
1836   {
1837 #pragma omp target teams distribute parallel for simd // OK
1838     for (int i = 0; i < 10; ++i)
1839       ;
1840   }
1841 #pragma omp single
1842   {
1843 #pragma omp target teams distribute simd // OK
1844     for (int i = 0; i < 10; ++i)
1845       ;
1846   }
1847 
1848 // MASTER DIRECTIVE
1849 #pragma omp master
1850   {
1851 #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?}}
1852     for (int i = 0; i < 10; ++i)
1853       ;
1854   }
1855 #pragma omp master
1856   {
1857 #pragma omp simd
1858     for (int i = 0; i < 10; ++i)
1859       ;
1860   }
1861 #pragma omp master
1862   {
1863 #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?}}
1864     for (int i = 0; i < 10; ++i)
1865       ;
1866   }
1867 #pragma omp master
1868   {
1869 #pragma omp parallel
1870     for (int i = 0; i < 10; ++i)
1871       ;
1872   }
1873 #pragma omp master
1874   {
1875 #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?}}
1876     {
1877       bar();
1878     }
1879   }
1880 #pragma omp master
1881   {
1882 #pragma omp master // OK, though second 'master' is redundant
1883     {
1884       bar();
1885     }
1886   }
1887 #pragma omp master
1888   {
1889 #pragma omp critical
1890     {
1891       bar();
1892     }
1893   }
1894 #pragma omp master
1895   {
1896 #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?}}
1897     {
1898       bar();
1899     }
1900   }
1901 #pragma omp master
1902   {
1903 #pragma omp parallel
1904     {
1905 #pragma omp master // OK
1906       {
1907         bar();
1908       }
1909 #pragma omp for // OK
1910       for (int i = 0; i < 10; ++i)
1911         ;
1912 #pragma omp for simd // OK
1913       for (int i = 0; i < 10; ++i)
1914         ;
1915 #pragma omp sections // OK
1916       {
1917         bar();
1918       }
1919     }
1920   }
1921 #pragma omp master
1922   {
1923 #pragma omp parallel for
1924     for (int i = 0; i < 10; ++i)
1925       ;
1926   }
1927 #pragma omp master
1928   {
1929 #pragma omp parallel for simd
1930     for (int i = 0; i < 10; ++i)
1931       ;
1932   }
1933 #pragma omp master
1934   {
1935 #pragma omp parallel sections
1936     {
1937       bar();
1938     }
1939   }
1940 #pragma omp master
1941   {
1942 #pragma omp task
1943     {
1944       bar();
1945     }
1946   }
1947 #pragma omp master
1948   {
1949 #pragma omp taskyield
1950     bar();
1951   }
1952 #pragma omp master
1953   {
1954 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}}
1955     bar();
1956   }
1957 #pragma omp master
1958   {
1959 #pragma omp taskwait
1960     bar();
1961   }
1962 #pragma omp master
1963   {
1964 #pragma omp flush
1965     bar();
1966   }
1967 #pragma omp master
1968   {
1969 #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?}}
1970     bar();
1971   }
1972 #pragma omp master
1973   {
1974 #pragma omp atomic
1975     ++a;
1976   }
1977 #pragma omp master
1978   {
1979 #pragma omp target
1980     ++a;
1981   }
1982 #pragma omp master
1983   {
1984 #pragma omp target parallel
1985     ++a;
1986   }
1987 #pragma omp master
1988   {
1989 #pragma omp target parallel for
1990     for (int i = 0; i < 10; ++i)
1991       ;
1992   }
1993 #pragma omp master
1994   {
1995 #pragma omp target enter data map(to: a)
1996     ++a;
1997   }
1998 #pragma omp master
1999   {
2000 #pragma omp target exit data map(from: a)
2001     ++a;
2002   }
2003 #pragma omp master
2004   {
2005 #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?}}
2006     ++a;
2007   }
2008 #pragma omp master
2009   {
2010 #pragma omp taskloop
2011   for (int i = 0; i < 10; ++i)
2012     ++a;
2013   }
2014 #pragma omp master
2015   {
2016 #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?}}
2017     for (int i = 0; i < 10; ++i)
2018       ;
2019   }
2020 #pragma omp master
2021   {
2022 #pragma omp target update to(a)
2023     bar();
2024   }
2025 #pragma omp master
2026   {
2027 #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?}}
2028     for (int i = 0; i < 10; ++i)
2029       ;
2030   }
2031 #pragma omp master
2032   {
2033 #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?}}
2034     for (int i = 0; i < 10; ++i)
2035       ;
2036   }
2037 #pragma omp master
2038   {
2039 #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?}}
2040     for (int i = 0; i < 10; ++i)
2041       ;
2042   }
2043 #pragma omp master
2044   {
2045 #pragma omp target simd // OK
2046     for (int i = 0; i < 10; ++i)
2047       ;
2048   }
2049 #pragma omp master
2050   {
2051 #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?}}
2052     for (int i = 0; i < 10; ++i)
2053       ;
2054   }
2055 #pragma omp master
2056   {
2057 #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?}}
2058     for (int i = 0; i < 10; ++i)
2059       ;
2060   }
2061 #pragma omp master
2062   {
2063 #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?}}
2064     for (int i = 0; i < 10; ++i)
2065       ;
2066   }
2067 #pragma omp master
2068   {
2069 #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?}}
2070     for (int i = 0; i < 10; ++i)
2071       ;
2072   }
2073 #pragma omp master
2074   {
2075 #pragma omp target teams // OK
2076     a++;
2077   }
2078 #pragma omp master
2079   {
2080 #pragma omp target teams distribute // OK
2081     for (int i = 0; i < 10; ++i)
2082       ;
2083   }
2084 #pragma omp master
2085   {
2086 #pragma omp target teams distribute parallel for // OK
2087     for (int i = 0; i < 10; ++i)
2088       ;
2089   }
2090 #pragma omp master
2091   {
2092 #pragma omp target teams distribute parallel for simd // OK
2093     for (int i = 0; i < 10; ++i)
2094       ;
2095   }
2096 #pragma omp master
2097   {
2098 #pragma omp target teams distribute simd // OK
2099     for (int i = 0; i < 10; ++i)
2100       ;
2101   }
2102 
2103 // CRITICAL DIRECTIVE
2104 #pragma omp critical
2105   {
2106 #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?}}
2107     for (int i = 0; i < 10; ++i)
2108       ;
2109   }
2110 #pragma omp critical
2111   {
2112 #pragma omp simd
2113     for (int i = 0; i < 10; ++i)
2114       ;
2115   }
2116 #pragma omp critical
2117   {
2118 #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?}}
2119     for (int i = 0; i < 10; ++i)
2120       ;
2121   }
2122 #pragma omp critical
2123   {
2124 #pragma omp parallel
2125     for (int i = 0; i < 10; ++i)
2126       ;
2127   }
2128 #pragma omp critical
2129   {
2130 #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?}}
2131     {
2132       bar();
2133     }
2134   }
2135 #pragma omp critical
2136   {
2137 #pragma omp master // OK, though second 'master' is redundant
2138     {
2139       bar();
2140     }
2141   }
2142 #pragma omp critical
2143   {
2144 #pragma omp critical
2145     {
2146       bar();
2147     }
2148   }
2149 #pragma omp critical
2150   {
2151 #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?}}
2152     {
2153       bar();
2154     }
2155   }
2156 #pragma omp critical
2157   {
2158 #pragma omp parallel
2159     {
2160 #pragma omp master // OK
2161       {
2162         bar();
2163       }
2164 #pragma omp for // OK
2165       for (int i = 0; i < 10; ++i)
2166         ;
2167 #pragma omp for simd // OK
2168       for (int i = 0; i < 10; ++i)
2169         ;
2170 #pragma omp sections // OK
2171       {
2172         bar();
2173       }
2174     }
2175   }
2176 #pragma omp critical
2177   {
2178 #pragma omp parallel for
2179     for (int i = 0; i < 10; ++i)
2180       ;
2181   }
2182 #pragma omp critical
2183   {
2184 #pragma omp parallel for simd
2185     for (int i = 0; i < 10; ++i)
2186       ;
2187   }
2188 #pragma omp critical
2189   {
2190 #pragma omp parallel sections
2191     {
2192       bar();
2193     }
2194   }
2195 #pragma omp critical
2196   {
2197 #pragma omp task
2198     {
2199       bar();
2200     }
2201   }
2202 #pragma omp critical
2203   {
2204 #pragma omp taskyield
2205     bar();
2206   }
2207 #pragma omp critical
2208   {
2209 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'critical' region}}
2210     bar();
2211   }
2212 #pragma omp critical
2213   {
2214 #pragma omp taskwait
2215     bar();
2216   }
2217 #pragma omp critical(Tuzik)
2218   {
2219 #pragma omp critical(grelka)
2220     bar();
2221   }
2222 #pragma omp critical(Belka) // expected-note {{previous 'critical' region starts here}}
2223   {
2224 #pragma omp critical(Belka) // expected-error {{cannot nest 'critical' regions having the same name 'Belka'}}
2225     {
2226 #pragma omp critical(Tuzik)
2227       {
2228 #pragma omp parallel
2229 #pragma omp critical(grelka)
2230         {
2231           bar();
2232         }
2233       }
2234     }
2235   }
2236 #pragma omp critical
2237   {
2238 #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?}}
2239     bar();
2240   }
2241 #pragma omp critical
2242   {
2243 #pragma omp atomic
2244     ++a;
2245   }
2246 #pragma omp critical
2247   {
2248 #pragma omp target
2249     ++a;
2250   }
2251 #pragma omp critical
2252   {
2253 #pragma omp target parallel
2254     ++a;
2255   }
2256 #pragma omp critical
2257   {
2258 #pragma omp target parallel for
2259     for (int i = 0; i < 10; ++i)
2260       ;
2261   }
2262 #pragma omp critical
2263   {
2264 #pragma omp target enter data map(to: a)
2265     ++a;
2266   }
2267 #pragma omp critical
2268   {
2269 #pragma omp target exit data map(from: a)
2270     ++a;
2271   }
2272 #pragma omp critical
2273   {
2274 #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?}}
2275     ++a;
2276   }
2277 #pragma omp critical
2278   {
2279 #pragma omp taskloop
2280   for (int i = 0; i < 10; ++i)
2281     ++a;
2282   }
2283 #pragma omp critical
2284   {
2285 #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?}}
2286     for (int i = 0; i < 10; ++i)
2287       ;
2288   }
2289 #pragma omp critical
2290   {
2291 #pragma omp target update to(a)
2292     bar();
2293   }
2294 #pragma omp critical
2295   {
2296 #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?}}
2297     for (int i = 0; i < 10; ++i)
2298       ;
2299   }
2300 #pragma omp critical
2301   {
2302 #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?}}
2303     for (int i = 0; i < 10; ++i)
2304       ;
2305   }
2306 #pragma omp critical
2307   {
2308 #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?}}
2309     for (int i = 0; i < 10; ++i)
2310       ;
2311   }
2312 #pragma omp critical
2313   {
2314 #pragma omp target simd // OK
2315     for (int i = 0; i < 10; ++i)
2316       ;
2317   }
2318 #pragma omp critical
2319   {
2320 #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?}}
2321     for (int i = 0; i < 10; ++i)
2322       ;
2323   }
2324 #pragma omp critical
2325   {
2326 #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?}}
2327     for (int i = 0; i < 10; ++i)
2328       ;
2329   }
2330 #pragma omp critical
2331   {
2332 #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?}}
2333     for (int i = 0; i < 10; ++i)
2334       ;
2335   }
2336 #pragma omp critical
2337   {
2338 #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?}}
2339     for (int i = 0; i < 10; ++i)
2340       ;
2341   }
2342 #pragma omp critical
2343   {
2344 #pragma omp target teams // OK
2345     a++;
2346   }
2347 #pragma omp critical
2348   {
2349 #pragma omp target teams distribute // OK
2350     for (int i = 0; i < 10; ++i)
2351       ;
2352   }
2353 #pragma omp critical
2354   {
2355 #pragma omp target teams distribute parallel for // OK
2356     for (int i = 0; i < 10; ++i)
2357       ;
2358   }
2359 #pragma omp critical
2360   {
2361 #pragma omp target teams distribute parallel for simd // OK
2362     for (int i = 0; i < 10; ++i)
2363       ;
2364   }
2365 #pragma omp critical
2366   {
2367 #pragma omp target teams distribute simd // OK
2368     for (int i = 0; i < 10; ++i)
2369       ;
2370   }
2371 
2372 // PARALLEL FOR DIRECTIVE
2373 #pragma omp parallel for
2374   for (int i = 0; i < 10; ++i) {
2375 #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?}}
2376     for (int i = 0; i < 10; ++i)
2377       ;
2378   }
2379 #pragma omp parallel for
2380   for (int i = 0; i < 10; ++i) {
2381 #pragma omp simd
2382     for (int i = 0; i < 10; ++i)
2383       ;
2384   }
2385 #pragma omp parallel for
2386   for (int i = 0; i < 10; ++i) {
2387 #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?}}
2388     for (int i = 0; i < 10; ++i)
2389       ;
2390   }
2391 #pragma omp parallel for
2392   for (int i = 0; i < 10; ++i) {
2393 #pragma omp parallel
2394     for (int i = 0; i < 10; ++i)
2395       ;
2396   }
2397 #pragma omp parallel for
2398   for (int i = 0; i < 10; ++i) {
2399 #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?}}
2400     {
2401       bar();
2402     }
2403   }
2404 #pragma omp parallel for
2405   for (int i = 0; i < 10; ++i) {
2406 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel for region}}
2407     {
2408       bar();
2409     }
2410   }
2411 #pragma omp parallel for
2412   for (int i = 0; i < 10; ++i) {
2413 #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?}}
2414     {
2415       bar();
2416     }
2417   }
2418 
2419 #pragma omp parallel for
2420   for (int i = 0; i < 10; ++i) {
2421 #pragma omp master // expected-error {{region cannot be closely nested inside 'parallel for' region}}
2422     {
2423       bar();
2424     }
2425   }
2426 
2427 #pragma omp parallel for
2428   for (int i = 0; i < 10; ++i) {
2429 #pragma omp critical
2430     {
2431       bar();
2432     }
2433   }
2434 
2435 #pragma omp parallel for
2436   for (int i = 0; i < 10; ++i) {
2437 #pragma omp parallel
2438     {
2439 #pragma omp single // OK
2440       {
2441         bar();
2442       }
2443 #pragma omp for // OK
2444       for (int i = 0; i < 10; ++i)
2445         ;
2446 #pragma omp for simd // OK
2447       for (int i = 0; i < 10; ++i)
2448         ;
2449 #pragma omp sections // OK
2450       {
2451         bar();
2452       }
2453     }
2454   }
2455 #pragma omp parallel for
2456   for (int i = 0; i < 10; ++i) {
2457 #pragma omp parallel for
2458     for (int i = 0; i < 10; ++i)
2459       ;
2460   }
2461 #pragma omp parallel for
2462   for (int i = 0; i < 10; ++i) {
2463 #pragma omp parallel for simd
2464     for (int i = 0; i < 10; ++i)
2465       ;
2466   }
2467 #pragma omp parallel for
2468   for (int i = 0; i < 10; ++i) {
2469 #pragma omp parallel sections
2470     {
2471       bar();
2472     }
2473   }
2474 #pragma omp parallel for
2475   for (int i = 0; i < 10; ++i) {
2476 #pragma omp task
2477     {
2478       bar();
2479     }
2480   }
2481 #pragma omp parallel for
2482   for (int i = 0; i < 10; ++i) {
2483 #pragma omp taskyield
2484     bar();
2485   }
2486 #pragma omp parallel for
2487   for (int i = 0; i < 10; ++i) {
2488 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}}
2489     bar();
2490   }
2491 #pragma omp parallel for
2492   for (int i = 0; i < 10; ++i) {
2493 #pragma omp taskwait
2494     bar();
2495   }
2496 #pragma omp parallel for
2497   for (int i = 0; i < 10; ++i) {
2498 #pragma omp flush
2499     bar();
2500   }
2501 #pragma omp parallel for
2502   for (int i = 0; i < 10; ++i) {
2503 #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?}}
2504     bar();
2505   }
2506 #pragma omp parallel for ordered
2507   for (int i = 0; i < 10; ++i) {
2508 #pragma omp ordered // OK
2509     bar();
2510   }
2511 #pragma omp parallel for
2512   for (int i = 0; i < 10; ++i) {
2513 #pragma omp atomic
2514     ++a;
2515   }
2516 #pragma omp parallel for
2517   for (int i = 0; i < 10; ++i) {
2518 #pragma omp target
2519     ++a;
2520   }
2521 #pragma omp parallel for
2522   for (int i = 0; i < 10; ++i) {
2523 #pragma omp target parallel
2524     ++a;
2525   }
2526 #pragma omp parallel for
2527   for (int i = 0; i < 10; ++i) {
2528 #pragma omp target parallel for
2529     for (int i = 0; i < 10; ++i)
2530       ;
2531   }
2532 #pragma omp parallel for
2533   for (int i = 0; i < 10; ++i) {
2534 #pragma omp target enter data map(to: a)
2535     ++a;
2536   }
2537 #pragma omp parallel for
2538   for (int i = 0; i < 10; ++i) {
2539 #pragma omp target exit data map(from: a)
2540     ++a;
2541   }
2542 #pragma omp parallel for
2543   for (int i = 0; i < 10; ++i) {
2544 #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?}}
2545     ++a;
2546   }
2547 #pragma omp parallel for
2548   for (int i = 0; i < 10; ++i) {
2549 #pragma omp taskloop
2550   for (int i = 0; i < 10; ++i)
2551     ++a;
2552   }
2553 #pragma omp parallel for
2554   for (int i = 0; i < 10; ++i) {
2555 #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?}}
2556     for (int j = 0; j < 10; ++j)
2557       ;
2558   }
2559 #pragma omp parallel for
2560   for (int i = 0; i < 10; ++i) {
2561 #pragma omp target update to(a)
2562   }
2563 #pragma omp parallel for
2564   for (int i = 0; i < 10; ++i) {
2565 #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?}}
2566     for (int j = 0; j < 10; ++j)
2567       ;
2568   }
2569 #pragma omp parallel for
2570   for (int i = 0; i < 10; ++i) {
2571 #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?}}
2572     for (int j = 0; j < 10; ++j)
2573       ;
2574   }
2575 #pragma omp parallel for
2576   for (int i = 0; i < 10; ++i) {
2577 #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?}}
2578     for (int j = 0; j < 10; ++j)
2579       ;
2580   }
2581 #pragma omp parallel for
2582   for (int i = 0; i < 10; ++i) {
2583 #pragma omp target simd // OK
2584     for (int j = 0; j < 10; ++j)
2585       ;
2586   }
2587 #pragma omp parallel for
2588   for (int i = 0; i < 10; ++i) {
2589 #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?}}
2590     for (int j = 0; j < 10; ++j)
2591       ;
2592   }
2593 #pragma omp parallel for
2594   for (int i = 0; i < 10; ++i) {
2595 #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?}}
2596     for (int j = 0; j < 10; ++j)
2597       ;
2598   }
2599 #pragma omp parallel for
2600   for (int i = 0; i < 10; ++i) {
2601 #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?}}
2602     for (int j = 0; j < 10; ++j)
2603       ;
2604   }
2605 #pragma omp parallel for
2606   for (int i = 0; i < 10; ++i) {
2607 #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?}}
2608     for (int j = 0; j < 10; ++j)
2609       ;
2610   }
2611 #pragma omp parallel for
2612   for (int i = 0; i < 10; ++i) {
2613 #pragma omp target teams // OK
2614     a++;
2615   }
2616 #pragma omp parallel for
2617   for (int i = 0; i < 10; ++i) {
2618 #pragma omp target teams distribute // OK
2619     for (int j = 0; j < 10; ++j)
2620       ;
2621   }
2622 #pragma omp parallel for
2623   for (int i = 0; i < 10; ++i) {
2624 #pragma omp target teams distribute parallel for // OK
2625     for (int j = 0; j < 10; ++j)
2626       ;
2627   }
2628 #pragma omp parallel for
2629   for (int i = 0; i < 10; ++i) {
2630 #pragma omp target teams distribute parallel for simd // OK
2631     for (int j = 0; j < 10; ++j)
2632       ;
2633   }
2634 #pragma omp parallel for
2635   for (int i = 0; i < 10; ++i) {
2636 #pragma omp target teams distribute simd // OK
2637     for (int j = 0; j < 10; ++j)
2638       ;
2639   }
2640 
2641 // PARALLEL FOR SIMD DIRECTIVE
2642 #pragma omp parallel for simd
2643   for (int i = 0; i < 10; ++i) {
2644 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2645     for (int i = 0; i < 10; ++i)
2646       ;
2647   }
2648 #pragma omp parallel for simd
2649   for (int i = 0; i < 10; ++i) {
2650 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
2651     for (int i = 0; i < 10; ++i)
2652       ;
2653   }
2654 #pragma omp parallel for simd
2655   for (int i = 0; i < 10; ++i) {
2656 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2657     for (int i = 0; i < 10; ++i)
2658       ;
2659   }
2660 #pragma omp parallel for simd
2661   for (int i = 0; i < 10; ++i) {
2662 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2663     for (int i = 0; i < 10; ++i)
2664       ;
2665   }
2666 #pragma omp parallel for simd
2667   for (int i = 0; i < 10; ++i) {
2668 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2669     {
2670       bar();
2671     }
2672   }
2673 #pragma omp parallel for simd
2674   for (int i = 0; i < 10; ++i) {
2675 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2676     {
2677       bar();
2678     }
2679   }
2680 #pragma omp parallel for simd
2681   for (int i = 0; i < 10; ++i) {
2682 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2683     {
2684       bar();
2685     }
2686   }
2687 
2688 #pragma omp parallel for simd
2689   for (int i = 0; i < 10; ++i) {
2690 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2691     {
2692       bar();
2693     }
2694   }
2695 
2696 #pragma omp parallel for simd
2697   for (int i = 0; i < 10; ++i) {
2698 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2699     {
2700       bar();
2701     }
2702   }
2703 
2704 #pragma omp parallel for simd
2705   for (int i = 0; i < 10; ++i) {
2706 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2707     {
2708 #pragma omp single
2709       {
2710         bar();
2711       }
2712 #pragma omp for
2713       for (int i = 0; i < 10; ++i)
2714         ;
2715 #pragma omp for simd
2716       for (int i = 0; i < 10; ++i)
2717         ;
2718 #pragma omp sections
2719       {
2720         bar();
2721       }
2722     }
2723   }
2724 #pragma omp parallel for simd
2725   for (int i = 0; i < 10; ++i) {
2726 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2727     for (int i = 0; i < 10; ++i)
2728       ;
2729   }
2730 #pragma omp parallel for simd
2731   for (int i = 0; i < 10; ++i) {
2732 #pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
2733     for (int i = 0; i < 10; ++i)
2734       ;
2735   }
2736 #pragma omp parallel for simd
2737   for (int i = 0; i < 10; ++i) {
2738 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2739     {
2740       bar();
2741     }
2742   }
2743 #pragma omp parallel for simd
2744   for (int i = 0; i < 10; ++i) {
2745 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2746     {
2747       bar();
2748     }
2749   }
2750 #pragma omp parallel for simd
2751   for (int i = 0; i < 10; ++i) {
2752 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2753     bar();
2754   }
2755 #pragma omp parallel for simd
2756   for (int i = 0; i < 10; ++i) {
2757 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2758     bar();
2759   }
2760 #pragma omp parallel for simd
2761   for (int i = 0; i < 10; ++i) {
2762 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2763     bar();
2764   }
2765 #pragma omp parallel for simd
2766   for (int i = 0; i < 10; ++i) {
2767 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2768     bar();
2769   }
2770 #pragma omp parallel for simd
2771   for (int i = 0; i < 10; ++i) {
2772 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2773     bar();
2774   }
2775 #pragma omp parallel for simd
2776   for (int i = 0; i < 10; ++i) {
2777 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2778     bar();
2779   }
2780 #pragma omp parallel for simd
2781   for (int i = 0; i < 10; ++i) {
2782 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2783     ++a;
2784   }
2785 #pragma omp parallel for simd
2786   for (int i = 0; i < 10; ++i) {
2787 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2788     ++a;
2789   }
2790 #pragma omp parallel for simd
2791   for (int i = 0; i < 10; ++i) {
2792 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2793     ++a;
2794   }
2795 #pragma omp parallel for simd
2796   for (int i = 0; i < 10; ++i) {
2797 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2798     for (int i = 0; i < 10; ++i)
2799       ;
2800   }
2801 #pragma omp parallel for simd
2802   for (int i = 0; i < 10; ++i) {
2803 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2804     ++a;
2805   }
2806 #pragma omp parallel for simd
2807   for (int i = 0; i < 10; ++i) {
2808 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2809     ++a;
2810   }
2811 #pragma omp parallel for simd
2812   for (int i = 0; i < 10; ++i) {
2813 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2814     ++a;
2815   }
2816 #pragma omp parallel for simd
2817   for (int i = 0; i < 10; ++i) {
2818 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2819   for (int i = 0; i < 10; ++i)
2820     ++a;
2821   }
2822 #pragma omp parallel for simd
2823   for (int i = 0; i < 10; ++i) {
2824 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2825     for (int j = 0; j < 10; ++j)
2826       ;
2827   }
2828 #pragma omp parallel for simd
2829   for (int i = 0; i < 10; ++i) {
2830 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2831     bar();
2832   }
2833 #pragma omp parallel for simd
2834   for (int i = 0; i < 10; ++i) {
2835 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2836     for (int j = 0; j < 10; ++j)
2837       ;
2838   }
2839 #pragma omp parallel for simd
2840   for (int i = 0; i < 10; ++i) {
2841 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2842     for (int j = 0; j < 10; ++j)
2843       ;
2844   }
2845 #pragma omp parallel for simd
2846   for (int i = 0; i < 10; ++i) {
2847 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2848     for (int j = 0; j < 10; ++j)
2849       ;
2850   }
2851 #pragma omp parallel for simd
2852   for (int i = 0; i < 10; ++i) {
2853 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2854     for (int j = 0; j < 10; ++j)
2855       ;
2856   }
2857 #pragma omp parallel for simd
2858   for (int i = 0; i < 10; ++i) {
2859 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2860     for (int j = 0; j < 10; ++j)
2861       ;
2862   }
2863 #pragma omp parallel for simd
2864   for (int i = 0; i < 10; ++i) {
2865 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2866     for (int j = 0; j < 10; ++j)
2867       ;
2868   }
2869 #pragma omp parallel for simd
2870   for (int i = 0; i < 10; ++i) {
2871 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2872     for (int j = 0; j < 10; ++j)
2873       ;
2874   }
2875 #pragma omp parallel for simd
2876   for (int i = 0; i < 10; ++i) {
2877 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2878     for (int j = 0; j < 10; ++j)
2879       ;
2880   }
2881 #pragma omp parallel for simd
2882   for (int i = 0; i < 10; ++i) {
2883 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2884     a++;
2885   }
2886 #pragma omp parallel for simd
2887   for (int i = 0; i < 10; ++i) {
2888 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2889     for (int j = 0; j < 10; ++j)
2890       ;
2891   }
2892 #pragma omp parallel for simd
2893   for (int i = 0; i < 10; ++i) {
2894 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2895     for (int j = 0; j < 10; ++j)
2896       ;
2897   }
2898 #pragma omp parallel for simd
2899   for (int i = 0; i < 10; ++i) {
2900 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2901     for (int j = 0; j < 10; ++j)
2902       ;
2903   }
2904 #pragma omp parallel for simd
2905   for (int i = 0; i < 10; ++i) {
2906 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
2907     for (int j = 0; j < 10; ++j)
2908       ;
2909   }
2910 
2911 // PARALLEL SECTIONS DIRECTIVE
2912 #pragma omp parallel sections
2913   {
2914 #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?}}
2915     for (int i = 0; i < 10; ++i)
2916       ;
2917   }
2918 #pragma omp parallel sections
2919   {
2920 #pragma omp simd
2921     for (int i = 0; i < 10; ++i)
2922       ;
2923   }
2924 #pragma omp parallel sections
2925   {
2926 #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?}}
2927     for (int i = 0; i < 10; ++i)
2928       ;
2929   }
2930 #pragma omp parallel sections
2931   {
2932 #pragma omp parallel
2933     for (int i = 0; i < 10; ++i)
2934       ;
2935   }
2936 #pragma omp parallel sections
2937   {
2938 #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?}}
2939     {
2940       bar();
2941     }
2942   }
2943 #pragma omp parallel sections
2944   {
2945 #pragma omp section
2946     {
2947       bar();
2948     }
2949   }
2950 #pragma omp parallel sections
2951   {
2952 #pragma omp section
2953     {
2954 #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?}}
2955       bar();
2956     }
2957   }
2958 #pragma omp parallel sections
2959   {
2960 #pragma omp section
2961     {
2962 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
2963       bar();
2964     }
2965   }
2966 #pragma omp parallel sections
2967   {
2968 #pragma omp section
2969     {
2970 #pragma omp critical
2971       bar();
2972     }
2973   }
2974 #pragma omp parallel sections
2975   {
2976 #pragma omp parallel
2977     {
2978 #pragma omp single // OK
2979       {
2980         bar();
2981       }
2982 #pragma omp for // OK
2983       for (int i = 0; i < 10; ++i)
2984         ;
2985 #pragma omp for simd // OK
2986       for (int i = 0; i < 10; ++i)
2987         ;
2988 #pragma omp sections // OK
2989       {
2990         bar();
2991       }
2992     }
2993   }
2994 #pragma omp parallel sections
2995   {
2996 #pragma omp parallel for
2997     for (int i = 0; i < 10; ++i)
2998       ;
2999   }
3000 #pragma omp parallel sections
3001   {
3002 #pragma omp parallel for simd
3003     for (int i = 0; i < 10; ++i)
3004       ;
3005   }
3006 #pragma omp parallel sections
3007   {
3008 #pragma omp parallel sections
3009     {
3010       bar();
3011     }
3012   }
3013 #pragma omp parallel sections
3014   {
3015 #pragma omp task
3016     {
3017       bar();
3018     }
3019   }
3020 #pragma omp parallel sections
3021   {
3022 #pragma omp taskyield
3023   }
3024 #pragma omp parallel sections
3025   {
3026 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}}
3027   }
3028 #pragma omp parallel sections
3029   {
3030 #pragma omp taskwait
3031   }
3032 #pragma omp parallel sections
3033   {
3034 #pragma omp flush
3035   }
3036 #pragma omp parallel sections
3037   {
3038 #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?}}
3039     bar();
3040   }
3041 #pragma omp parallel sections
3042   {
3043 #pragma omp atomic
3044     ++a;
3045   }
3046 #pragma omp parallel sections
3047   {
3048 #pragma omp target
3049     ++a;
3050   }
3051 #pragma omp parallel sections
3052   {
3053 #pragma omp target parallel
3054     ++a;
3055   }
3056 #pragma omp parallel sections
3057   {
3058 #pragma omp target parallel for
3059     for (int i = 0; i < 10; ++i)
3060       ;
3061   }
3062 #pragma omp parallel sections
3063   {
3064 #pragma omp target enter data map(to: a)
3065   }
3066 #pragma omp parallel sections
3067   {
3068 #pragma omp target exit data map(from: a)
3069   }
3070 #pragma omp parallel sections
3071   {
3072 #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?}}
3073     ++a;
3074   }
3075 #pragma omp parallel sections
3076   {
3077 #pragma omp taskloop
3078   for (int i = 0; i < 10; ++i)
3079     ++a;
3080   }
3081 #pragma omp parallel sections
3082   {
3083 #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?}}
3084     for (int i = 0; i < 10; ++i)
3085       ;
3086   }
3087 #pragma omp parallel sections
3088   {
3089 #pragma omp target update to(a)
3090   }
3091 #pragma omp parallel sections
3092   {
3093 #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?}}
3094     for (int i = 0; i < 10; ++i)
3095       ;
3096   }
3097 #pragma omp parallel sections
3098   {
3099 #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?}}
3100     for (int i = 0; i < 10; ++i)
3101       ;
3102   }
3103 #pragma omp parallel sections
3104   {
3105 #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?}}
3106     for (int i = 0; i < 10; ++i)
3107       ;
3108   }
3109 #pragma omp parallel sections
3110   {
3111 #pragma omp target simd // OK
3112     for (int i = 0; i < 10; ++i)
3113       ;
3114   }
3115 #pragma omp parallel sections
3116   {
3117 #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?}}
3118     for (int i = 0; i < 10; ++i)
3119       ;
3120   }
3121 #pragma omp parallel sections
3122   {
3123 #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?}}
3124     for (int i = 0; i < 10; ++i)
3125       ;
3126   }
3127 #pragma omp parallel sections
3128   {
3129 #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?}}
3130     for (int i = 0; i < 10; ++i)
3131       ;
3132   }
3133 #pragma omp parallel sections
3134   {
3135 #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?}}
3136     for (int i = 0; i < 10; ++i)
3137       ;
3138   }
3139 #pragma omp parallel sections
3140   {
3141 #pragma omp target teams // OK
3142     a++;
3143   }
3144 #pragma omp parallel sections
3145   {
3146 #pragma omp target teams distribute // OK
3147     for (int i = 0; i < 10; ++i)
3148       ;
3149   }
3150 #pragma omp parallel sections
3151   {
3152 #pragma omp target teams distribute parallel for // OK
3153     for (int i = 0; i < 10; ++i)
3154       ;
3155   }
3156 #pragma omp parallel sections
3157   {
3158 #pragma omp target teams distribute parallel for simd // OK
3159     for (int i = 0; i < 10; ++i)
3160       ;
3161   }
3162 #pragma omp parallel sections
3163   {
3164 #pragma omp target teams distribute simd // OK
3165     for (int i = 0; i < 10; ++i)
3166       ;
3167   }
3168 
3169 // TASK DIRECTIVE
3170 #pragma omp task
3171 #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?}}
3172   for (int i = 0; i < 10; ++i)
3173     ;
3174 #pragma omp task
3175 #pragma omp simd
3176   for (int i = 0; i < 10; ++i)
3177     ;
3178 #pragma omp task
3179 #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?}}
3180   for (int i = 0; i < 10; ++i)
3181     ;
3182 #pragma omp task
3183 #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?}}
3184   {
3185     bar();
3186   }
3187 #pragma omp task
3188 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a task region}}
3189   {
3190     bar();
3191   }
3192 #pragma omp task
3193 #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?}}
3194   bar();
3195 #pragma omp task
3196 #pragma omp master // expected-error {{region cannot be closely nested inside 'task' region}}
3197   bar();
3198 #pragma omp task
3199 #pragma omp critical
3200   bar();
3201 
3202 #pragma omp task
3203 #pragma omp parallel for
3204   for (int i = 0; i < 10; ++i)
3205     ;
3206 #pragma omp task
3207 #pragma omp parallel for simd
3208   for (int i = 0; i < 10; ++i)
3209     ;
3210 #pragma omp task
3211 #pragma omp parallel sections
3212   {
3213     bar();
3214   }
3215 #pragma omp task
3216 #pragma omp task
3217   {
3218     bar();
3219   }
3220 #pragma omp task
3221   {
3222 #pragma omp taskyield
3223     bar();
3224   }
3225 #pragma omp task
3226   {
3227 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}}
3228     bar();
3229   }
3230 #pragma omp task
3231   {
3232 #pragma omp taskwait
3233     bar();
3234   }
3235 #pragma omp task
3236   {
3237 #pragma omp flush
3238     bar();
3239   }
3240 #pragma omp task
3241   {
3242 #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?}}
3243     bar();
3244   }
3245 #pragma omp task
3246   {
3247 #pragma omp atomic
3248     ++a;
3249   }
3250 #pragma omp task
3251   {
3252 #pragma omp target
3253     ++a;
3254   }
3255 #pragma omp task
3256   {
3257 #pragma omp target parallel
3258     ++a;
3259   }
3260 #pragma omp task
3261 #pragma omp target parallel for
3262   for (int i = 0; i < 10; ++i)
3263     ;
3264 #pragma omp task
3265   {
3266 #pragma omp target enter data map(to: a)
3267     ++a;
3268   }
3269 #pragma omp task
3270   {
3271 #pragma omp target exit data map(from: a)
3272     ++a;
3273   }
3274 #pragma omp task
3275   {
3276 #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?}}
3277     ++a;
3278   }
3279 #pragma omp task
3280   {
3281 #pragma omp taskloop
3282   for (int i = 0; i < 10; ++i)
3283     ++a;
3284   }
3285 #pragma omp task
3286   {
3287 #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?}}
3288     for (int i = 0; i < 10; ++i)
3289       ;
3290   }
3291 #pragma omp task
3292   {
3293 #pragma omp target update to(a)
3294     bar();
3295   }
3296 #pragma omp task
3297   {
3298 #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?}}
3299     for (int i = 0; i < 10; ++i)
3300       ;
3301   }
3302 #pragma omp task
3303   {
3304 #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?}}
3305     for (int i = 0; i < 10; ++i)
3306       ;
3307   }
3308 #pragma omp task
3309   {
3310 #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?}}
3311     for (int i = 0; i < 10; ++i)
3312       ;
3313   }
3314 #pragma omp task
3315   {
3316 #pragma omp target simd // OK
3317     for (int i = 0; i < 10; ++i)
3318       ;
3319   }
3320 #pragma omp task
3321   {
3322 #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?}}
3323     for (int i = 0; i < 10; ++i)
3324       ;
3325   }
3326 #pragma omp task
3327   {
3328 #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?}}
3329     for (int i = 0; i < 10; ++i)
3330       ;
3331   }
3332 #pragma omp task
3333   {
3334 #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?}}
3335     for (int i = 0; i < 10; ++i)
3336       ;
3337   }
3338 #pragma omp task
3339   {
3340 #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?}}
3341     for (int i = 0; i < 10; ++i)
3342       ;
3343   }
3344 #pragma omp task
3345   {
3346 #pragma omp target teams // OK
3347     a++;
3348   }
3349 #pragma omp task
3350   {
3351 #pragma omp target teams distribute // OK
3352     for (int i = 0; i < 10; ++i)
3353       ;
3354   }
3355 #pragma omp task
3356   {
3357 #pragma omp target teams distribute parallel for // OK
3358     for (int i = 0; i < 10; ++i)
3359       ;
3360   }
3361 #pragma omp task
3362   {
3363 #pragma omp target teams distribute parallel for simd // OK
3364     for (int i = 0; i < 10; ++i)
3365       ;
3366   }
3367 #pragma omp task
3368   {
3369 #pragma omp target teams distribute simd // OK
3370     for (int i = 0; i < 10; ++i)
3371       ;
3372   }
3373 
3374 // ORDERED DIRECTIVE
3375 #pragma omp ordered
3376   {
3377 #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?}}
3378     for (int i = 0; i < 10; ++i)
3379       ;
3380   }
3381 #pragma omp ordered
3382   {
3383 #pragma omp simd
3384     for (int i = 0; i < 10; ++i)
3385       ;
3386   }
3387 #pragma omp ordered
3388   {
3389 #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?}}
3390     for (int i = 0; i < 10; ++i)
3391       ;
3392   }
3393 #pragma omp ordered
3394   {
3395 #pragma omp parallel
3396     for (int i = 0; i < 10; ++i)
3397       ;
3398   }
3399 #pragma omp ordered
3400   {
3401 #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?}}
3402     {
3403       bar();
3404     }
3405   }
3406 #pragma omp ordered
3407   {
3408 #pragma omp master // OK, though second 'ordered' is redundant
3409     {
3410       bar();
3411     }
3412   }
3413 #pragma omp ordered
3414   {
3415 #pragma omp critical
3416     {
3417       bar();
3418     }
3419   }
3420 #pragma omp ordered
3421   {
3422 #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?}}
3423     {
3424       bar();
3425     }
3426   }
3427 #pragma omp ordered
3428   {
3429 #pragma omp parallel for ordered
3430     for (int j = 0; j < 10; ++j) {
3431 #pragma omp ordered // OK
3432       {
3433         bar();
3434       }
3435     }
3436   }
3437 #pragma omp ordered
3438   {
3439 #pragma omp parallel for simd ordered
3440     for (int j = 0; j < 10; ++j) {
3441 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
3442       {
3443         bar();
3444       }
3445     }
3446   }
3447 #pragma omp ordered
3448   {
3449 #pragma omp parallel for simd ordered
3450     for (int j = 0; j < 10; ++j) {
3451 #pragma omp ordered simd
3452       {
3453         bar();
3454       }
3455     }
3456   }
3457 #pragma omp ordered
3458   {
3459 #pragma omp parallel for
3460     for (int i = 0; i < 10; ++i)
3461       ;
3462   }
3463 #pragma omp ordered
3464   {
3465 #pragma omp parallel for simd
3466     for (int i = 0; i < 10; ++i)
3467       ;
3468   }
3469 #pragma omp ordered
3470   {
3471 #pragma omp parallel sections
3472     {
3473       bar();
3474     }
3475   }
3476 #pragma omp ordered
3477   {
3478 #pragma omp task
3479     {
3480       bar();
3481     }
3482   }
3483 #pragma omp ordered
3484   {
3485 #pragma omp taskyield
3486     bar();
3487   }
3488 #pragma omp ordered
3489   {
3490 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'ordered' region}}
3491     bar();
3492   }
3493 #pragma omp ordered
3494   {
3495 #pragma omp taskwait
3496     bar();
3497   }
3498 #pragma omp ordered
3499   {
3500 #pragma omp flush
3501     bar();
3502   }
3503 #pragma omp ordered
3504   {
3505 #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?}}
3506     bar();
3507   }
3508 #pragma omp ordered
3509   {
3510 #pragma omp atomic
3511     ++a;
3512   }
3513 #pragma omp ordered
3514   {
3515 #pragma omp target
3516     ++a;
3517   }
3518 #pragma omp ordered
3519   {
3520 #pragma omp target parallel
3521     ++a;
3522   }
3523 #pragma omp ordered
3524   {
3525 #pragma omp target parallel for ordered
3526     for (int j = 0; j < 10; ++j) {
3527 #pragma omp ordered // OK
3528       {
3529         bar();
3530       }
3531     }
3532   }
3533 #pragma omp ordered
3534   {
3535 #pragma omp target parallel for
3536     for (int i = 0; i < 10; ++i)
3537       ;
3538   }
3539 #pragma omp ordered
3540   {
3541 #pragma omp target enter data map(to: a)
3542     ++a;
3543   }
3544 #pragma omp ordered
3545   {
3546 #pragma omp target exit data map(from: a)
3547     ++a;
3548   }
3549 #pragma omp ordered
3550   {
3551 #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?}}
3552     ++a;
3553   }
3554 #pragma omp ordered
3555   {
3556 #pragma omp taskloop
3557   for (int i = 0; i < 10; ++i)
3558     ++a;
3559   }
3560 #pragma omp ordered
3561   {
3562 #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?}}
3563     for (int i = 0; i < 10; ++i)
3564       ;
3565   }
3566 #pragma omp ordered
3567   {
3568     bar();
3569 #pragma omp target update to(a)
3570     bar();
3571   }
3572 #pragma omp ordered
3573   {
3574 #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?}}
3575     for (int i = 0; i < 10; ++i)
3576       ;
3577   }
3578 #pragma omp ordered
3579   {
3580 #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?}}
3581     for (int i = 0; i < 10; ++i)
3582       ;
3583   }
3584 #pragma omp ordered
3585   {
3586 #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?}}
3587     for (int i = 0; i < 10; ++i)
3588       ;
3589   }
3590 #pragma omp ordered
3591   {
3592 #pragma omp target simd // OK
3593     for (int i = 0; i < 10; ++i)
3594       ;
3595   }
3596 #pragma omp ordered
3597   {
3598 #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?}}
3599     for (int i = 0; i < 10; ++i)
3600       ;
3601   }
3602 #pragma omp ordered
3603   {
3604 #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?}}
3605     for (int i = 0; i < 10; ++i)
3606       ;
3607   }
3608 #pragma omp ordered
3609   {
3610 #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?}}
3611     for (int i = 0; i < 10; ++i)
3612       ;
3613   }
3614 #pragma omp ordered
3615   {
3616 #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?}}
3617     for (int i = 0; i < 10; ++i)
3618       ;
3619   }
3620 #pragma omp ordered
3621   {
3622 #pragma omp target teams // OK
3623     a++;
3624   }
3625 #pragma omp ordered
3626   {
3627 #pragma omp target teams distribute // OK
3628     for (int i = 0; i < 10; ++i)
3629       ;
3630   }
3631 #pragma omp ordered
3632   {
3633 #pragma omp target teams distribute parallel for // OK
3634     for (int i = 0; i < 10; ++i)
3635       ;
3636   }
3637 #pragma omp ordered
3638   {
3639 #pragma omp target teams distribute parallel for simd // OK
3640     for (int i = 0; i < 10; ++i)
3641       ;
3642   }
3643 #pragma omp ordered
3644   {
3645 #pragma omp target teams distribute simd // OK
3646     for (int i = 0; i < 10; ++i)
3647       ;
3648   }
3649 
3650 // ATOMIC DIRECTIVE
3651 #pragma omp atomic
3652   // 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}}
3653   // expected-note@+1 {{expected an expression statement}}
3654   {
3655 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3656     for (int i = 0; i < 10; ++i)
3657       ;
3658   }
3659 #pragma omp atomic
3660   // 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}}
3661   // expected-note@+1 {{expected an expression statement}}
3662   {
3663 #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3664     for (int i = 0; i < 10; ++i)
3665       ;
3666   }
3667 #pragma omp atomic
3668   // 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}}
3669   // expected-note@+1 {{expected an expression statement}}
3670   {
3671 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3672     for (int i = 0; i < 10; ++i)
3673       ;
3674   }
3675 #pragma omp atomic
3676   // 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}}
3677   // expected-note@+1 {{expected an expression statement}}
3678   {
3679 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3680     for (int i = 0; i < 10; ++i)
3681       ;
3682   }
3683 #pragma omp atomic
3684   // 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}}
3685   // expected-note@+1 {{expected an expression statement}}
3686   {
3687 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3688     {
3689       bar();
3690     }
3691   }
3692 #pragma omp atomic
3693   // 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}}
3694   // expected-note@+1 {{expected an expression statement}}
3695   {
3696 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3697     {
3698       bar();
3699     }
3700   }
3701 #pragma omp atomic
3702   // 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}}
3703   // expected-note@+1 {{expected an expression statement}}
3704   {
3705 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3706     {
3707       bar();
3708     }
3709   }
3710 #pragma omp atomic
3711   // 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}}
3712   // expected-note@+1 {{expected an expression statement}}
3713   {
3714 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3715     {
3716       bar();
3717     }
3718   }
3719 #pragma omp atomic
3720   // 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}}
3721   // expected-note@+1 {{expected an expression statement}}
3722   {
3723 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3724     {
3725       bar();
3726     }
3727   }
3728 #pragma omp atomic
3729   // 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}}
3730   // expected-note@+1 {{expected an expression statement}}
3731   {
3732 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3733     for (int i = 0; i < 10; ++i)
3734       ;
3735   }
3736 #pragma omp atomic
3737   // 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}}
3738   // expected-note@+1 {{expected an expression statement}}
3739   {
3740 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3741     for (int i = 0; i < 10; ++i)
3742       ;
3743   }
3744 #pragma omp atomic
3745   // 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}}
3746   // expected-note@+1 {{expected an expression statement}}
3747   {
3748 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3749     {
3750       bar();
3751     }
3752   }
3753 #pragma omp atomic
3754   // 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}}
3755   // expected-note@+1 {{expected an expression statement}}
3756   {
3757 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3758     {
3759       bar();
3760     }
3761   }
3762 #pragma omp atomic
3763   // 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}}
3764   // expected-note@+1 {{expected an expression statement}}
3765   {
3766 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3767     bar();
3768   }
3769 #pragma omp atomic
3770   // 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}}
3771   // expected-note@+1 {{expected an expression statement}}
3772   {
3773 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3774     bar();
3775   }
3776 #pragma omp atomic
3777   // 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}}
3778   // expected-note@+1 {{expected an expression statement}}
3779   {
3780 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3781     bar();
3782   }
3783 #pragma omp atomic
3784   // 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}}
3785   // expected-note@+1 {{expected an expression statement}}
3786   {
3787 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3788     bar();
3789   }
3790 #pragma omp atomic
3791   // 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}}
3792   // expected-note@+1 {{expected an expression statement}}
3793   {
3794 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3795     bar();
3796   }
3797 #pragma omp atomic
3798   // 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}}
3799   // expected-note@+1 {{expected an expression statement}}
3800   {
3801 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3802     ++a;
3803   }
3804 #pragma omp atomic
3805   // 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}}
3806   // expected-note@+1 {{expected an expression statement}}
3807   {
3808 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3809     ++a;
3810   }
3811 #pragma omp atomic
3812   // 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}}
3813   // expected-note@+1 {{expected an expression statement}}
3814   {
3815 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3816     ++a;
3817   }
3818 #pragma omp atomic
3819   // 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}}
3820   // expected-note@+1 {{expected an expression statement}}
3821   {
3822 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3823     for (int i = 0; i < 10; ++i)
3824       ;
3825   }
3826 #pragma omp atomic
3827   // 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}}
3828   // expected-note@+1 {{expected an expression statement}}
3829   {
3830 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3831     ++a;
3832   }
3833 #pragma omp atomic
3834   // 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}}
3835   // expected-note@+1 {{expected an expression statement}}
3836   {
3837 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3838     ++a;
3839   }
3840 #pragma omp atomic
3841   // 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}}
3842   // expected-note@+1 {{expected an expression statement}}
3843   {
3844 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3845     ++a;
3846   }
3847 #pragma omp atomic
3848   // 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}}
3849   // expected-note@+1 {{expected an expression statement}}
3850   {
3851 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3852   for (int i = 0; i < 10; ++i)
3853     ++a;
3854   }
3855 #pragma omp atomic
3856   // 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}}
3857   // expected-note@+1 {{expected an expression statement}}
3858   {
3859 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3860     for (int i = 0; i < 10; ++i)
3861       ;
3862   }
3863 #pragma omp atomic
3864   // 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}}
3865   // expected-note@+1 {{expected an expression statement}}
3866   {
3867 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3868     bar();
3869   }
3870 #pragma omp atomic
3871   // 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}}
3872   // expected-note@+1 {{expected an expression statement}}
3873   {
3874 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3875     for (int i = 0; i < 10; ++i)
3876       ;
3877   }
3878 #pragma omp atomic
3879   // 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}}
3880   // expected-note@+1 {{expected an expression statement}}
3881   {
3882 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3883     for (int i = 0; i < 10; ++i)
3884       ;
3885   }
3886 #pragma omp atomic
3887   // 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}}
3888   // expected-note@+1 {{expected an expression statement}}
3889   {
3890 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3891     for (int i = 0; i < 10; ++i)
3892       ;
3893   }
3894 #pragma omp atomic
3895   // 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}}
3896   // expected-note@+1 {{expected an expression statement}}
3897   {
3898 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3899     for (int i = 0; i < 10; ++i)
3900       ;
3901   }
3902 #pragma omp atomic
3903   // 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}}
3904   // expected-note@+1 {{expected an expression statement}}
3905   {
3906 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3907     for (int i = 0; i < 10; ++i)
3908       ;
3909   }
3910 #pragma omp atomic
3911   // 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}}
3912   // expected-note@+1 {{expected an expression statement}}
3913   {
3914 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3915     for (int i = 0; i < 10; ++i)
3916       ;
3917   }
3918 #pragma omp atomic
3919   // 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}}
3920   // expected-note@+1 {{expected an expression statement}}
3921   {
3922 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3923     for (int i = 0; i < 10; ++i)
3924       ;
3925   }
3926 #pragma omp atomic
3927   // 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}}
3928   // expected-note@+1 {{expected an expression statement}}
3929   {
3930 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3931     for (int i = 0; i < 10; ++i)
3932       ;
3933   }
3934 #pragma omp atomic
3935   // 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}}
3936   // expected-note@+1 {{expected an expression statement}}
3937   {
3938 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3939     a++;
3940   }
3941 #pragma omp atomic
3942   // 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}}
3943   // expected-note@+1 {{expected an expression statement}}
3944   {
3945 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3946     for (int i = 0; i < 10; ++i)
3947       ;
3948   }
3949 #pragma omp atomic
3950   // 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}}
3951   // expected-note@+1 {{expected an expression statement}}
3952   {
3953 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3954     for (int i = 0; i < 10; ++i)
3955       ;
3956   }
3957 #pragma omp atomic
3958   // 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}}
3959   // expected-note@+1 {{expected an expression statement}}
3960   {
3961 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3962     for (int i = 0; i < 10; ++i)
3963       ;
3964   }
3965 #pragma omp atomic
3966   // 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}}
3967   // expected-note@+1 {{expected an expression statement}}
3968   {
3969 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
3970     for (int i = 0; i < 10; ++i)
3971       ;
3972   }
3973 
3974 // TARGET DIRECTIVE
3975 #pragma omp target
3976 #pragma omp parallel
3977   bar();
3978 #pragma omp target
3979 #pragma omp for
3980   for (int i = 0; i < 10; ++i)
3981     ;
3982 #pragma omp target
3983 #pragma omp simd
3984   for (int i = 0; i < 10; ++i)
3985     ;
3986 #pragma omp target
3987 #pragma omp for simd
3988   for (int i = 0; i < 10; ++i)
3989     ;
3990 #pragma omp target
3991 #pragma omp sections
3992   {
3993     bar();
3994   }
3995 #pragma omp target
3996 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target region}}
3997   {
3998     bar();
3999   }
4000 #pragma omp target
4001 #pragma omp single
4002   bar();
4003 
4004 #pragma omp target
4005 #pragma omp master
4006   {
4007     bar();
4008   }
4009 #pragma omp target
4010 #pragma omp critical
4011   {
4012     bar();
4013   }
4014 #pragma omp target
4015 #pragma omp parallel for
4016   for (int i = 0; i < 10; ++i)
4017     ;
4018 #pragma omp target
4019 #pragma omp parallel for simd
4020   for (int i = 0; i < 10; ++i)
4021     ;
4022 #pragma omp target
4023 #pragma omp parallel sections
4024   {
4025     bar();
4026   }
4027 #pragma omp target
4028 #pragma omp task
4029   {
4030     bar();
4031   }
4032 #pragma omp target
4033   {
4034 #pragma omp taskyield
4035     bar();
4036   }
4037 #pragma omp target
4038   {
4039 #pragma omp barrier
4040     bar();
4041   }
4042 #pragma omp target
4043   {
4044 #pragma omp taskwait
4045     bar();
4046   }
4047 #pragma omp target
4048   {
4049 #pragma omp flush
4050     bar();
4051   }
4052 #pragma omp target
4053   {
4054 #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?}}
4055     bar();
4056   }
4057 #pragma omp target
4058   {
4059 #pragma omp atomic
4060     ++a;
4061   }
4062 #pragma omp target
4063   {
4064 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
4065     ++a;
4066   }
4067 #pragma omp target
4068   {
4069 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
4070     ++a;
4071   }
4072 #pragma omp target
4073 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
4074   for (int i = 0; i < 10; ++i)
4075     ;
4076 #pragma omp target
4077   {
4078 #pragma omp teams
4079     ++a;
4080   }
4081 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
4082   {
4083     ++a;           // expected-note {{statement outside teams construct here}}
4084 #pragma omp teams  // expected-note {{nested teams construct here}}
4085     ++a;
4086   }
4087 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
4088   {
4089     while (0)      // expected-note {{statement outside teams construct here}}
4090 #pragma omp teams  // expected-note {{nested teams construct here}}
4091     ++a;
4092   }
4093 #pragma omp target
4094   {
4095 #pragma omp taskloop
4096   for (int i = 0; i < 10; ++i)
4097     ++a;
4098   }
4099 #pragma omp target
4100   {
4101 #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?}}
4102     for (int i = 0; i < 10; ++i)
4103       ;
4104   }
4105 #pragma omp target
4106   {
4107 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
4108   }
4109 #pragma omp target
4110   {
4111 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
4112   }
4113 #pragma omp target
4114   {
4115 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
4116   }
4117 #pragma omp target
4118   {
4119 #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?}}
4120     for (int i = 0; i < 10; ++i)
4121       ;
4122   }
4123 #pragma omp target
4124   {
4125 #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?}}
4126     for (int i = 0; i < 10; ++i)
4127       ;
4128   }
4129 #pragma omp target
4130   {
4131 #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?}}
4132     for (int i = 0; i < 10; ++i)
4133       ;
4134   }
4135 #pragma omp target
4136   {
4137 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
4138     for (int i = 0; i < 10; ++i)
4139       ;
4140   }
4141 #pragma omp target
4142   {
4143 #pragma omp teams distribute // OK
4144     for (int i = 0; i < 10; ++i)
4145       ;
4146   }
4147 #pragma omp target
4148   {
4149 #pragma omp teams distribute simd // OK
4150     for (int i = 0; i < 10; ++i)
4151       ;
4152   }
4153 #pragma omp target
4154   {
4155 #pragma omp teams distribute parallel for simd // OK
4156     for (int i = 0; i < 10; ++i)
4157       ;
4158   }
4159 #pragma omp target
4160   {
4161 #pragma omp teams distribute parallel for // OK
4162     for (int i = 0; i < 10; ++i)
4163       ;
4164   }
4165 #pragma omp target
4166   {
4167 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
4168     for (int i = 0; i < 10; ++i)
4169       ;
4170   }
4171 #pragma omp target
4172   {
4173 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
4174     for (int i = 0; i < 10; ++i)
4175       ;
4176   }
4177 #pragma omp target
4178   {
4179 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
4180     for (int i = 0; i < 10; ++i)
4181       ;
4182   }
4183 #pragma omp target
4184   {
4185 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
4186     for (int i = 0; i < 10; ++i)
4187       ;
4188   }
4189 #pragma omp target
4190   {
4191 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
4192     for (int i = 0; i < 10; ++i)
4193       ;
4194   }
4195 
4196 // TARGET PARALLEL DIRECTIVE
4197 #pragma omp target parallel
4198 #pragma omp parallel
4199   bar();
4200 #pragma omp target parallel
4201 #pragma omp for
4202   for (int i = 0; i < 10; ++i)
4203     ;
4204 #pragma omp target parallel
4205 #pragma omp simd
4206   for (int i = 0; i < 10; ++i)
4207     ;
4208 #pragma omp target parallel
4209 #pragma omp for simd
4210   for (int i = 0; i < 10; ++i)
4211     ;
4212 #pragma omp target parallel
4213 #pragma omp sections
4214   {
4215     bar();
4216   }
4217 #pragma omp target parallel
4218 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel region}}
4219   {
4220     bar();
4221   }
4222 #pragma omp target parallel
4223 #pragma omp single
4224   bar();
4225 
4226 #pragma omp target parallel
4227 #pragma omp master
4228   {
4229     bar();
4230   }
4231 #pragma omp target parallel
4232 #pragma omp critical
4233   {
4234     bar();
4235   }
4236 #pragma omp target parallel
4237 #pragma omp parallel for
4238   for (int i = 0; i < 10; ++i)
4239     ;
4240 #pragma omp target parallel
4241 #pragma omp parallel for simd
4242   for (int i = 0; i < 10; ++i)
4243     ;
4244 #pragma omp target parallel
4245 #pragma omp parallel sections
4246   {
4247     bar();
4248   }
4249 #pragma omp target parallel
4250 #pragma omp task
4251   {
4252     bar();
4253   }
4254 #pragma omp target parallel
4255   {
4256 #pragma omp taskyield
4257     bar();
4258   }
4259 #pragma omp target parallel
4260   {
4261 #pragma omp barrier
4262     bar();
4263   }
4264 #pragma omp target parallel
4265   {
4266 #pragma omp taskwait
4267     bar();
4268   }
4269 #pragma omp target parallel
4270   {
4271 #pragma omp flush
4272     bar();
4273   }
4274 #pragma omp target parallel
4275   {
4276 #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?}}
4277     bar();
4278   }
4279 #pragma omp target parallel
4280   {
4281 #pragma omp atomic
4282     ++a;
4283   }
4284 #pragma omp target parallel
4285   {
4286 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel' region}}
4287     ++a;
4288   }
4289 #pragma omp target parallel
4290   {
4291 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel' region}}
4292     ++a;
4293   }
4294 #pragma omp target parallel
4295 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel' region}}
4296   for (int i = 0; i < 10; ++i)
4297     ;
4298 #pragma omp target parallel
4299   {
4300 #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?}}
4301     ++a;
4302   }
4303 #pragma omp target parallel
4304   {
4305     ++a;
4306 #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?}}
4307     ++a;
4308   }
4309 #pragma omp target parallel
4310   {
4311 #pragma omp taskloop
4312   for (int i = 0; i < 10; ++i)
4313     ++a;
4314   }
4315 #pragma omp target parallel
4316   {
4317 #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?}}
4318     for (int i = 0; i < 10; ++i)
4319       ;
4320   }
4321 #pragma omp target parallel
4322   {
4323 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel' region}}
4324   }
4325 #pragma omp target parallel
4326   {
4327 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel' region}}
4328   }
4329 #pragma omp target parallel
4330   {
4331 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel' region}}
4332   }
4333 #pragma omp target parallel
4334   {
4335 #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?}}
4336     for (int i = 0; i < 10; ++i)
4337       ;
4338   }
4339 #pragma omp target parallel
4340   {
4341 #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?}}
4342     for (int i = 0; i < 10; ++i)
4343       ;
4344   }
4345 #pragma omp target parallel
4346   {
4347 #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?}}
4348     for (int i = 0; i < 10; ++i)
4349       ;
4350   }
4351 #pragma omp target parallel
4352   {
4353 #pragma omp target simd // expected-error {{region cannot be nested inside 'target parallel' region}}
4354     for (int i = 0; i < 10; ++i)
4355       ;
4356   }
4357 #pragma omp target parallel
4358   {
4359 #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?}}
4360     for (int i = 0; i < 10; ++i)
4361       ;
4362   }
4363 #pragma omp target parallel
4364   {
4365 #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?}}
4366     for (int i = 0; i < 10; ++i)
4367       ;
4368   }
4369 #pragma omp target parallel
4370   {
4371 #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?}}
4372     for (int i = 0; i < 10; ++i)
4373       ;
4374   }
4375 #pragma omp target parallel
4376   {
4377 #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?}}
4378     for (int i = 0; i < 10; ++i)
4379       ;
4380   }
4381 #pragma omp target parallel
4382   {
4383 #pragma omp target teams // expected-error {{region cannot be nested inside 'target parallel' region}}
4384     a++;
4385   }
4386 #pragma omp target parallel
4387   {
4388 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target parallel' region}}
4389     for (int i = 0; i < 10; ++i)
4390       ;
4391   }
4392 #pragma omp target parallel
4393   {
4394 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target parallel' region}}
4395     for (int i = 0; i < 10; ++i)
4396       ;
4397   }
4398 #pragma omp target parallel
4399   {
4400 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target parallel' region}}
4401     for (int i = 0; i < 10; ++i)
4402       ;
4403   }
4404 #pragma omp target parallel
4405   {
4406 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target parallel' region}}
4407     for (int i = 0; i < 10; ++i)
4408       ;
4409   }
4410 
4411 // TARGET PARALLEL FOR DIRECTIVE
4412 #pragma omp target parallel for
4413   for (int i = 0; i < 10; ++i) {
4414 #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?}}
4415     for (int i = 0; i < 10; ++i)
4416       ;
4417   }
4418 #pragma omp target parallel for
4419   for (int i = 0; i < 10; ++i) {
4420 #pragma omp simd
4421     for (int i = 0; i < 10; ++i)
4422       ;
4423   }
4424 #pragma omp target parallel for
4425   for (int i = 0; i < 10; ++i) {
4426 #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?}}
4427     for (int i = 0; i < 10; ++i)
4428       ;
4429   }
4430 #pragma omp target parallel for
4431   for (int i = 0; i < 10; ++i) {
4432 #pragma omp parallel
4433     for (int i = 0; i < 10; ++i)
4434       ;
4435   }
4436 #pragma omp target parallel for
4437   for (int i = 0; i < 10; ++i) {
4438 #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?}}
4439     {
4440       bar();
4441     }
4442   }
4443 #pragma omp target parallel for
4444   for (int i = 0; i < 10; ++i) {
4445 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel for region}}
4446     {
4447       bar();
4448     }
4449   }
4450 #pragma omp target parallel for
4451   for (int i = 0; i < 10; ++i) {
4452 #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?}}
4453     {
4454       bar();
4455     }
4456   }
4457 
4458 #pragma omp target parallel for
4459   for (int i = 0; i < 10; ++i) {
4460 #pragma omp master // expected-error {{region cannot be closely nested inside 'target parallel for' region}}
4461     {
4462       bar();
4463     }
4464   }
4465 
4466 #pragma omp target parallel for
4467   for (int i = 0; i < 10; ++i) {
4468 #pragma omp critical
4469     {
4470       bar();
4471     }
4472   }
4473 
4474 #pragma omp target parallel for
4475   for (int i = 0; i < 10; ++i) {
4476 #pragma omp parallel
4477     {
4478 #pragma omp single // OK
4479       {
4480         bar();
4481       }
4482 #pragma omp for // OK
4483       for (int i = 0; i < 10; ++i)
4484         ;
4485 #pragma omp for simd // OK
4486       for (int i = 0; i < 10; ++i)
4487         ;
4488 #pragma omp sections // OK
4489       {
4490         bar();
4491       }
4492     }
4493   }
4494 #pragma omp target parallel for
4495   for (int i = 0; i < 10; ++i) {
4496 #pragma omp parallel for
4497     for (int i = 0; i < 10; ++i)
4498       ;
4499   }
4500 #pragma omp target parallel for
4501   for (int i = 0; i < 10; ++i) {
4502 #pragma omp parallel for simd
4503     for (int i = 0; i < 10; ++i)
4504       ;
4505   }
4506 #pragma omp target parallel for
4507   for (int i = 0; i < 10; ++i) {
4508 #pragma omp parallel sections
4509     {
4510       bar();
4511     }
4512   }
4513 #pragma omp target parallel for
4514   for (int i = 0; i < 10; ++i) {
4515 #pragma omp task
4516     {
4517       bar();
4518     }
4519   }
4520 #pragma omp target parallel for
4521   for (int i = 0; i < 10; ++i) {
4522 #pragma omp taskyield
4523     bar();
4524   }
4525 #pragma omp target parallel for
4526   for (int i = 0; i < 10; ++i) {
4527 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target parallel for' region}}
4528     bar();
4529   }
4530 #pragma omp target parallel for
4531   for (int i = 0; i < 10; ++i) {
4532 #pragma omp taskwait
4533     bar();
4534   }
4535 #pragma omp target parallel for
4536   for (int i = 0; i < 10; ++i) {
4537 #pragma omp flush
4538     bar();
4539   }
4540 #pragma omp target parallel for
4541   for (int i = 0; i < 10; ++i) {
4542 #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?}}
4543     bar();
4544   }
4545 #pragma omp target parallel for ordered
4546   for (int i = 0; i < 10; ++i) {
4547 #pragma omp ordered // OK
4548     bar();
4549   }
4550 #pragma omp target parallel for
4551   for (int i = 0; i < 10; ++i) {
4552 #pragma omp atomic
4553     ++a;
4554   }
4555 #pragma omp target parallel for
4556   for (int i = 0; i < 10; ++i) {
4557 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel for' region}}
4558     ++a;
4559   }
4560 #pragma omp target parallel for
4561   for (int i = 0; i < 10; ++i) {
4562 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel for' region}}
4563     ++a;
4564   }
4565 #pragma omp target parallel for
4566   for (int i = 0; i < 10; ++i) {
4567 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}}
4568     for (int i = 0; i < 10; ++i)
4569       ;
4570   }
4571 #pragma omp target parallel for
4572   for (int i = 0; i < 10; ++i) {
4573 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
4574     ++a;
4575   }
4576 #pragma omp target parallel for
4577   for (int i = 0; i < 10; ++i) {
4578 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
4579     ++a;
4580   }
4581 #pragma omp target parallel for
4582   for (int i = 0; i < 10; ++i) {
4583 #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?}}
4584     ++a;
4585   }
4586 #pragma omp target parallel for
4587   for (int i = 0; i < 10; ++i) {
4588 #pragma omp taskloop
4589   for (int i = 0; i < 10; ++i)
4590     ++a;
4591   }
4592 #pragma omp target parallel for
4593   for (int i = 0; i < 10; ++i) {
4594 #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?}}
4595     for (int j = 0; j < 10; ++j)
4596       ;
4597   }
4598 #pragma omp target parallel for
4599   for (int i = 0; i < 10; ++i) {
4600 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
4601   }
4602 #pragma omp target parallel for
4603   for (int i = 0; i < 10; ++i) {
4604 #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?}}
4605     for (int j = 0; j < 10; ++j)
4606       ;
4607   }
4608 #pragma omp target parallel for
4609   for (int i = 0; i < 10; ++i) {
4610 #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?}}
4611     for (int j = 0; j < 10; ++j)
4612       ;
4613   }
4614 #pragma omp target parallel for
4615   for (int i = 0; i < 10; ++i) {
4616 #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?}}
4617     for (int j = 0; j < 10; ++j)
4618       ;
4619   }
4620 #pragma omp target parallel for
4621   for (int i = 0; i < 10; ++i) {
4622 #pragma omp target simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
4623     for (int j = 0; j < 10; ++j)
4624       ;
4625   }
4626 #pragma omp target parallel for
4627   for (int i = 0; i < 10; ++i) {
4628 #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?}}
4629     for (int j = 0; j < 10; ++j)
4630       ;
4631   }
4632 #pragma omp target parallel for
4633   for (int i = 0; i < 10; ++i) {
4634 #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?}}
4635     for (int j = 0; j < 10; ++j)
4636       ;
4637   }
4638 #pragma omp target parallel for
4639   for (int i = 0; i < 10; ++i) {
4640 #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?}}
4641     for (int j = 0; j < 10; ++j)
4642       ;
4643   }
4644 #pragma omp target parallel for
4645   for (int i = 0; i < 10; ++i) {
4646 #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?}}
4647     for (int j = 0; j < 10; ++j)
4648       ;
4649   }
4650 #pragma omp target parallel for
4651   for (int i = 0; i < 10; ++i) {
4652 #pragma omp target teams // expected-error {{region cannot be nested inside 'target parallel for' region}}
4653     a++;
4654   }
4655 #pragma omp target parallel for
4656   for (int i = 0; i < 10; ++i) {
4657 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target parallel for' region}}
4658     for (int j = 0; j < 10; ++j)
4659       ;
4660   }
4661 #pragma omp target parallel for
4662   for (int i = 0; i < 10; ++i) {
4663 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}}
4664     for (int j = 0; j < 10; ++j)
4665       ;
4666   }
4667 #pragma omp target parallel for
4668   for (int i = 0; i < 10; ++i) {
4669 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
4670     for (int j = 0; j < 10; ++j)
4671       ;
4672   }
4673 #pragma omp target parallel for
4674   for (int i = 0; i < 10; ++i) {
4675 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
4676     for (int j = 0; j < 10; ++j)
4677       ;
4678   }
4679 
4680 // TEAMS DIRECTIVE
4681 #pragma omp teams // expected-error {{orphaned 'omp teams' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
4682   bar();
4683 #pragma omp target
4684 #pragma omp teams
4685 #pragma omp parallel
4686   bar();
4687 #pragma omp target
4688 #pragma omp teams
4689 #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?}}
4690   for (int i = 0; i < 10; ++i)
4691     ;
4692 #pragma omp target
4693 #pragma omp teams
4694 #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?}}
4695   for (int i = 0; i < 10; ++i)
4696     ;
4697 #pragma omp target
4698 #pragma omp teams
4699 #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?}}
4700   for (int i = 0; i < 10; ++i)
4701     ;
4702 #pragma omp target
4703 #pragma omp teams
4704 #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?}}
4705   {
4706     bar();
4707   }
4708 #pragma omp target
4709 #pragma omp teams
4710 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams region}}
4711   {
4712     bar();
4713   }
4714 #pragma omp target
4715 #pragma omp teams
4716 #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?}}
4717   bar();
4718 
4719 #pragma omp target
4720 #pragma omp teams
4721 #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?}}
4722   {
4723     bar();
4724   }
4725 #pragma omp target
4726 #pragma omp teams
4727 #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?}}
4728   {
4729     bar();
4730   }
4731 #pragma omp target
4732 #pragma omp teams
4733 #pragma omp parallel for
4734   for (int i = 0; i < 10; ++i)
4735     ;
4736 #pragma omp target
4737 #pragma omp teams
4738 #pragma omp parallel for simd
4739   for (int i = 0; i < 10; ++i)
4740     ;
4741 #pragma omp target
4742 #pragma omp teams
4743 #pragma omp parallel sections
4744   {
4745     bar();
4746   }
4747 #pragma omp target
4748 #pragma omp teams
4749 #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?}}
4750   {
4751     bar();
4752   }
4753 #pragma omp target
4754 #pragma omp teams
4755   {
4756 #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?}}
4757     bar();
4758   }
4759 #pragma omp target
4760 #pragma omp teams
4761   {
4762 #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?}}
4763     bar();
4764   }
4765 #pragma omp target
4766 #pragma omp teams
4767   {
4768 #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?}}
4769     bar();
4770   }
4771 #pragma omp target
4772 #pragma omp teams
4773   {
4774 #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?}}
4775     bar();
4776   }
4777 #pragma omp target
4778 #pragma omp teams
4779   {
4780 #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?}}
4781     bar();
4782   }
4783 #pragma omp target
4784 #pragma omp teams
4785   {
4786 #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?}}
4787     ++a;
4788   }
4789 #pragma omp target
4790 #pragma omp teams
4791   {
4792 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
4793     ++a;
4794   }
4795 #pragma omp target
4796 #pragma omp teams
4797   {
4798 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
4799     ++a;
4800   }
4801 #pragma omp target
4802 #pragma omp teams
4803 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
4804   for (int i = 0; i < 10; ++i)
4805     ;
4806 #pragma omp target
4807 #pragma omp teams
4808   {
4809 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
4810     ++a;
4811   }
4812 #pragma omp target
4813 #pragma omp teams
4814   {
4815 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
4816     ++a;
4817   }
4818 #pragma omp target
4819 #pragma omp teams
4820   {
4821 #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?}}
4822     ++a;
4823   }
4824 #pragma omp target
4825 #pragma omp teams
4826   {
4827 #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?}}
4828   for (int i = 0; i < 10; ++i)
4829     ++a;
4830   }
4831 #pragma omp target
4832 #pragma omp teams
4833 #pragma omp distribute
4834   for (int i = 0; i < 10; ++i)
4835     ;
4836 #pragma omp target
4837 #pragma omp teams
4838 #pragma omp distribute
4839   for (int i = 0; i < 10; ++i)
4840     ;
4841 #pragma omp distribute
4842   for (int j = 0; j < 10; ++j)
4843     ;
4844 #pragma omp target
4845 #pragma omp teams
4846   {
4847 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
4848   }
4849 #pragma omp target
4850 #pragma omp teams
4851   {
4852 #pragma omp distribute parallel for
4853   for (int i = 0; i < 10; ++i)
4854     ;
4855 #pragma omp distribute parallel for
4856   for (int j = 0; j < 10; ++j)
4857     ;
4858   }
4859 #pragma omp target
4860 #pragma omp teams
4861   {
4862 #pragma omp distribute parallel for simd
4863   for (int i = 0; i < 10; ++i)
4864     ;
4865 #pragma omp distribute parallel for simd
4866   for (int j = 0; j < 10; ++j)
4867     ;
4868   }
4869 #pragma omp target
4870 #pragma omp teams
4871   {
4872 #pragma omp distribute simd
4873   for (int i = 0; i < 10; ++i)
4874     ;
4875 #pragma omp distribute simd
4876   for (int j = 0; j < 10; ++j)
4877     ;
4878   }
4879 #pragma omp target
4880 #pragma omp teams
4881   {
4882 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
4883   for (int i = 0; i < 10; ++i)
4884     ;
4885   }
4886 #pragma omp target
4887 #pragma omp teams
4888   {
4889 #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?}}
4890   for (int i = 0; i < 10; ++i)
4891     ;
4892   }
4893 #pragma omp target
4894 #pragma omp teams
4895   {
4896 #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?}}
4897   for (int i = 0; i < 10; ++i)
4898     ;
4899   }
4900 #pragma omp target
4901 #pragma omp teams
4902   {
4903 #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?}}
4904   for (int i = 0; i < 10; ++i)
4905     ;
4906   }
4907 #pragma omp target
4908 #pragma omp teams
4909   {
4910 #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?}}
4911   for (int i = 0; i < 10; ++i)
4912     ;
4913   }
4914 #pragma omp target
4915 #pragma omp teams
4916   {
4917 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
4918     a++;
4919   }
4920 #pragma omp target
4921 #pragma omp teams
4922   {
4923 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
4924   for (int i = 0; i < 10; ++i)
4925     ;
4926   }
4927 #pragma omp target
4928 #pragma omp teams
4929   {
4930 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
4931   for (int i = 0; i < 10; ++i)
4932     ;
4933   }
4934 #pragma omp target
4935 #pragma omp teams
4936   {
4937 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
4938   for (int i = 0; i < 10; ++i)
4939     ;
4940   }
4941 #pragma omp target
4942 #pragma omp teams
4943   {
4944 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
4945   for (int i = 0; i < 10; ++i)
4946     ;
4947   }
4948 
4949 // TASKLOOP DIRECTIVE
4950 #pragma omp taskloop
4951   for (int i = 0; i < 10; ++i) {
4952 #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?}}
4953     for (int i = 0; i < 10; ++i)
4954       ;
4955   }
4956 #pragma omp taskloop
4957   for (int i = 0; i < 10; ++i) {
4958 #pragma omp simd
4959     for (int i = 0; i < 10; ++i)
4960       ;
4961   }
4962 #pragma omp taskloop
4963   for (int i = 0; i < 10; ++i) {
4964 #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?}}
4965     for (int i = 0; i < 10; ++i)
4966       ;
4967   }
4968 #pragma omp taskloop
4969   for (int i = 0; i < 10; ++i) {
4970 #pragma omp parallel
4971     for (int i = 0; i < 10; ++i)
4972       ;
4973   }
4974 #pragma omp taskloop
4975   for (int i = 0; i < 10; ++i) {
4976 #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?}}
4977     {
4978       bar();
4979     }
4980   }
4981 #pragma omp taskloop
4982   for (int i = 0; i < 10; ++i) {
4983 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a taskloop region}}
4984     {
4985       bar();
4986     }
4987   }
4988 #pragma omp taskloop
4989   for (int i = 0; i < 10; ++i) {
4990 #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?}}
4991     {
4992       bar();
4993     }
4994   }
4995 
4996 #pragma omp taskloop
4997   for (int i = 0; i < 10; ++i) {
4998 #pragma omp master // expected-error {{region cannot be closely nested inside 'taskloop' region}}
4999     {
5000       bar();
5001     }
5002   }
5003 #pragma omp taskloop
5004   for (int i = 0; i < 10; ++i) {
5005 #pragma omp critical
5006     {
5007       bar();
5008     }
5009   }
5010 #pragma omp taskloop
5011   for (int i = 0; i < 10; ++i) {
5012 #pragma omp parallel
5013     {
5014 #pragma omp single // OK
5015       {
5016         bar();
5017       }
5018 #pragma omp for // OK
5019       for (int i = 0; i < 10; ++i)
5020         ;
5021 #pragma omp sections // OK
5022       {
5023         bar();
5024       }
5025     }
5026   }
5027 #pragma omp taskloop
5028   for (int i = 0; i < 10; ++i) {
5029 #pragma omp parallel for
5030     for (int i = 0; i < 10; ++i)
5031       ;
5032   }
5033 #pragma omp taskloop
5034   for (int i = 0; i < 10; ++i) {
5035 #pragma omp parallel for simd
5036     for (int i = 0; i < 10; ++i)
5037       ;
5038   }
5039 #pragma omp taskloop
5040   for (int i = 0; i < 10; ++i) {
5041 #pragma omp parallel sections
5042     {
5043       bar();
5044     }
5045   }
5046 #pragma omp taskloop
5047   for (int i = 0; i < 10; ++i) {
5048 #pragma omp task
5049     {
5050       bar();
5051     }
5052   }
5053 #pragma omp taskloop
5054   for (int i = 0; i < 10; ++i) {
5055 #pragma omp taskyield
5056     bar();
5057   }
5058 #pragma omp taskloop
5059   for (int i = 0; i < 10; ++i) {
5060 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'taskloop' region}}
5061     bar();
5062   }
5063 #pragma omp taskloop
5064   for (int i = 0; i < 10; ++i) {
5065 #pragma omp taskwait
5066     bar();
5067   }
5068 #pragma omp taskloop
5069   for (int i = 0; i < 10; ++i) {
5070 #pragma omp flush
5071     bar();
5072   }
5073 #pragma omp taskloop
5074   for (int i = 0; i < 10; ++i) {
5075 #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?}}
5076     bar();
5077   }
5078 #pragma omp taskloop
5079   for (int i = 0; i < 10; ++i) {
5080 #pragma omp atomic
5081     ++a;
5082   }
5083 #pragma omp taskloop
5084   for (int i = 0; i < 10; ++i) {
5085 #pragma omp target
5086     ++a;
5087   }
5088 #pragma omp taskloop
5089   for (int i = 0; i < 10; ++i) {
5090 #pragma omp target parallel
5091     ++a;
5092   }
5093 #pragma omp taskloop
5094   for (int i = 0; i < 10; ++i) {
5095 #pragma omp target parallel for
5096     for (int i = 0; i < 10; ++i)
5097       ;
5098   }
5099 #pragma omp taskloop
5100   for (int i = 0; i < 10; ++i) {
5101 #pragma omp target enter data map(to: a)
5102     ++a;
5103   }
5104 #pragma omp taskloop
5105   for (int i = 0; i < 10; ++i) {
5106 #pragma omp target exit data map(from: a)
5107     ++a;
5108   }
5109 #pragma omp taskloop
5110   for (int i = 0; i < 10; ++i) {
5111 #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?}}
5112     ++a;
5113   }
5114 #pragma omp taskloop
5115   for (int i = 0; i < 10; ++i) {
5116 #pragma omp taskloop
5117   for (int i = 0; i < 10; ++i)
5118     ++a;
5119   }
5120 #pragma omp taskloop
5121   for (int i = 0; i < 10; ++i) {
5122 #pragma omp target update to(a)
5123     bar();
5124   }
5125 #pragma omp taskloop
5126   for (int i = 0; i < 10; ++i) {
5127 #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?}}
5128   for (int j = 0; j < 10; ++j)
5129     ++a;
5130   }
5131 #pragma omp taskloop
5132   for (int i = 0; i < 10; ++i) {
5133 #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?}}
5134   for (int j = 0; j < 10; ++j)
5135     ++a;
5136   }
5137 #pragma omp taskloop
5138   for (int i = 0; i < 10; ++i) {
5139 #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?}}
5140   for (int j = 0; j < 10; ++j)
5141     ++a;
5142   }
5143 #pragma omp taskloop
5144   for (int i = 0; i < 10; ++i) {
5145 #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?}}
5146   for (int j = 0; j < 10; ++j)
5147     ++a;
5148   }
5149 #pragma omp taskloop
5150   for (int i = 0; i < 10; ++i) {
5151 #pragma omp target simd // OK
5152   for (int j = 0; j < 10; ++j)
5153     ++a;
5154   }
5155 #pragma omp taskloop
5156   for (int i = 0; i < 10; ++i) {
5157 #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?}}
5158   for (int j = 0; j < 10; ++j)
5159     ++a;
5160   }
5161 #pragma omp taskloop
5162   for (int i = 0; i < 10; ++i) {
5163 #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?}}
5164   for (int j = 0; j < 10; ++j)
5165     ++a;
5166   }
5167 #pragma omp taskloop
5168   for (int i = 0; i < 10; ++i) {
5169 #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?}}
5170   for (int j = 0; j < 10; ++j)
5171     ++a;
5172   }
5173 #pragma omp taskloop
5174   for (int i = 0; i < 10; ++i) {
5175 #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?}}
5176   for (int j = 0; j < 10; ++j)
5177     ++a;
5178   }
5179 #pragma omp taskloop
5180   for (int i = 0; i < 10; ++i) {
5181 #pragma omp target teams // OK
5182     ++a;
5183   }
5184 #pragma omp taskloop
5185   for (int i = 0; i < 10; ++i) {
5186 #pragma omp target teams distribute // OK
5187   for (int j = 0; j < 10; ++j)
5188     ++a;
5189   }
5190 #pragma omp taskloop
5191   for (int i = 0; i < 10; ++i) {
5192 #pragma omp target teams distribute parallel for // OK
5193   for (int j = 0; j < 10; ++j)
5194     ++a;
5195   }
5196 #pragma omp taskloop
5197   for (int i = 0; i < 10; ++i) {
5198 #pragma omp target teams distribute parallel for simd // OK
5199   for (int j = 0; j < 10; ++j)
5200     ++a;
5201   }
5202 #pragma omp taskloop
5203   for (int i = 0; i < 10; ++i) {
5204 #pragma omp target teams distribute simd // OK
5205   for (int j = 0; j < 10; ++j)
5206     ++a;
5207   }
5208 
5209 // DISTRIBUTE DIRECTIVE
5210 #pragma omp target
5211 #pragma omp teams
5212 #pragma omp distribute
5213   for (int i = 0; i < 10; ++i) {
5214 #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?}}
5215     for (int i = 0; i < 10; ++i)
5216       ;
5217   }
5218 #pragma omp target
5219 #pragma omp teams
5220 #pragma omp distribute
5221   for (int i = 0; i < 10; ++i) {
5222 #pragma omp for
5223     for (int i = 0; i < 10; ++i)
5224       ;
5225   }
5226 #pragma omp target
5227 #pragma omp teams
5228 #pragma omp distribute
5229   for (int i = 0; i < 10; ++i) {
5230 #pragma omp simd
5231     for (int i = 0; i < 10; ++i)
5232       ;
5233   }
5234 #pragma omp target
5235 #pragma omp teams
5236 #pragma omp distribute
5237   for (int i = 0; i < 10; ++i) {
5238 #pragma omp for simd
5239     for (int i = 0; i < 10; ++i)
5240       ;
5241   }
5242 #pragma omp target
5243 #pragma omp teams
5244 #pragma omp distribute
5245   for (int i = 0; i < 10; ++i) {
5246 #pragma omp parallel
5247     for (int i = 0; i < 10; ++i)
5248       ;
5249   }
5250 #pragma omp target
5251 #pragma omp teams
5252 #pragma omp distribute
5253   for (int i = 0; i < 10; ++i) {
5254 #pragma omp sections
5255     {
5256       bar();
5257     }
5258   }
5259 #pragma omp target
5260 #pragma omp teams
5261 #pragma omp distribute
5262   for (int i = 0; i < 10; ++i) {
5263 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute region}}
5264     {
5265       bar();
5266     }
5267   }
5268 #pragma omp target
5269 #pragma omp teams
5270 #pragma omp distribute
5271   for (int i = 0; i < 10; ++i) {
5272 #pragma omp single
5273     {
5274       bar();
5275     }
5276   }
5277 #pragma omp target
5278 #pragma omp teams
5279 #pragma omp distribute
5280   for (int i = 0; i < 10; ++i) {
5281 #pragma omp master
5282     {
5283       bar();
5284     }
5285   }
5286 #pragma omp target
5287 #pragma omp teams
5288 #pragma omp distribute
5289   for (int i = 0; i < 10; ++i) {
5290 #pragma omp critical
5291     {
5292       bar();
5293     }
5294   }
5295 #pragma omp target
5296 #pragma omp teams
5297 #pragma omp distribute
5298   for (int i = 0; i < 10; ++i) {
5299 #pragma omp parallel
5300     {
5301 #pragma omp single
5302       {
5303 	bar();
5304       }
5305     }
5306   }
5307 #pragma omp target
5308 #pragma omp teams
5309 #pragma omp distribute
5310   for (int i = 0; i < 10; ++i) {
5311 #pragma omp parallel for
5312     for (int i = 0; i < 10; ++i)
5313       ;
5314   }
5315 #pragma omp target
5316 #pragma omp teams
5317 #pragma omp distribute
5318   for (int i = 0; i < 10; ++i) {
5319 #pragma omp parallel for simd
5320     for (int i = 0; i < 10; ++i)
5321       ;
5322   }
5323 #pragma omp target
5324 #pragma omp teams
5325 #pragma omp distribute
5326   for (int i = 0; i < 10; ++i) {
5327 #pragma omp parallel sections
5328     {
5329       bar();
5330     }
5331   }
5332 #pragma omp target
5333 #pragma omp teams
5334 #pragma omp distribute
5335   for (int i = 0; i < 10; ++i) {
5336 #pragma omp task
5337     {
5338       bar();
5339     }
5340   }
5341 #pragma omp target
5342 #pragma omp teams
5343 #pragma omp distribute
5344   for (int i = 0; i < 10; ++i) {
5345 #pragma omp taskyield
5346     bar();
5347   }
5348 #pragma omp target
5349 #pragma omp teams
5350 #pragma omp distribute
5351   for (int i = 0; i < 10; ++i) {
5352 #pragma omp barrier
5353     bar();
5354   }
5355 #pragma omp target
5356 #pragma omp teams
5357 #pragma omp distribute
5358   for (int i = 0; i < 10; ++i) {
5359 #pragma omp taskwait
5360     bar();
5361   }
5362 #pragma omp target
5363 #pragma omp teams
5364 #pragma omp distribute
5365   for (int i = 0; i < 10; ++i) {
5366 #pragma omp flush
5367     bar();
5368   }
5369 #pragma omp target
5370 #pragma omp teams
5371 #pragma omp distribute
5372   for (int i = 0; i < 10; ++i) {
5373 #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?}}
5374     bar();
5375   }
5376 #pragma omp target
5377 #pragma omp teams
5378 #pragma omp distribute
5379   for (int i = 0; i < 10; ++i) {
5380 #pragma omp atomic
5381     ++a;
5382   }
5383 #pragma omp target
5384 #pragma omp teams
5385 #pragma omp distribute
5386   for (int i = 0; i < 10; ++i) {
5387 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
5388     ++a;
5389   }
5390 #pragma omp target
5391 #pragma omp teams
5392 #pragma omp distribute
5393   for (int i = 0; i < 10; ++i) {
5394 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
5395     ++a;
5396   }
5397 #pragma omp target
5398 #pragma omp teams
5399 #pragma omp distribute
5400   for (int i = 0; i < 10; ++i) {
5401 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
5402     for (int i = 0; i < 10; ++i)
5403       ;
5404   }
5405 #pragma omp target
5406 #pragma omp teams
5407 #pragma omp distribute
5408   for (int i = 0; i < 10; ++i) {
5409 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
5410     ++a;
5411   }
5412 #pragma omp target
5413 #pragma omp teams
5414 #pragma omp distribute
5415   for (int i = 0; i < 10; ++i) {
5416 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
5417     ++a;
5418   }
5419 #pragma omp target
5420 #pragma omp teams
5421 #pragma omp distribute
5422   for (int i = 0; i < 10; ++i) {
5423 #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?}}
5424     ++a;
5425   }
5426 #pragma omp target
5427 #pragma omp teams
5428 #pragma omp distribute
5429   for (int i = 0; i < 10; ++i) {
5430 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
5431     ++a;
5432   }
5433 #pragma omp target
5434 #pragma omp teams
5435 #pragma omp distribute
5436   for (int i = 0; i < 10; ++i) {
5437 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
5438     for (int j = 0; j < 10; ++j)
5439       ;
5440   }
5441 #pragma omp target
5442 #pragma omp teams
5443 #pragma omp distribute
5444   for (int i = 0; i < 10; ++i) {
5445 #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?}}
5446     for (int j = 0; j < 10; ++j)
5447       ;
5448   }
5449 #pragma omp target
5450 #pragma omp teams
5451 #pragma omp distribute
5452   for (int i = 0; i < 10; ++i) {
5453 #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?}}
5454     for (int j = 0; j < 10; ++j)
5455       ;
5456   }
5457 #pragma omp target
5458 #pragma omp teams
5459 #pragma omp distribute
5460   for (int i = 0; i < 10; ++i) {
5461 #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?}}
5462     for (int j = 0; j < 10; ++j)
5463       ;
5464   }
5465 #pragma omp target
5466 #pragma omp teams
5467 #pragma omp distribute
5468   for (int i = 0; i < 10; ++i) {
5469 #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?}}
5470     for (int j = 0; j < 10; ++j)
5471       ;
5472   }
5473 #pragma omp target
5474 #pragma omp teams
5475 #pragma omp distribute
5476   for (int i = 0; i < 10; ++i) {
5477 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
5478     a++;
5479   }
5480 #pragma omp target
5481 #pragma omp teams
5482 #pragma omp distribute
5483   for (int i = 0; i < 10; ++i) {
5484 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
5485     for (int j = 0; j < 10; ++j)
5486       ;
5487   }
5488 #pragma omp target
5489 #pragma omp teams
5490 #pragma omp distribute
5491   for (int i = 0; i < 10; ++i) {
5492 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
5493     for (int j = 0; j < 10; ++j)
5494       ;
5495   }
5496 #pragma omp target
5497 #pragma omp teams
5498 #pragma omp distribute
5499   for (int i = 0; i < 10; ++i) {
5500 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
5501     for (int j = 0; j < 10; ++j)
5502       ;
5503   }
5504 #pragma omp target
5505 #pragma omp teams
5506 #pragma omp distribute
5507   for (int i = 0; i < 10; ++i) {
5508 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
5509     for (int j = 0; j < 10; ++j)
5510       ;
5511   }
5512 
5513 // DISTRIBUTE PARALLEL FOR DIRECTIVE
5514 #pragma omp target
5515 #pragma omp teams
5516 #pragma omp distribute parallel for
5517   for (int i = 0; i < 10; ++i) {
5518 #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?}}
5519     for (int i = 0; i < 10; ++i)
5520       ;
5521   }
5522 #pragma omp target
5523 #pragma omp teams
5524 #pragma omp distribute parallel for
5525   for (int i = 0; i < 10; ++i) {
5526 #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?}}
5527     for (int i = 0; i < 10; ++i)
5528       ;
5529   }
5530 #pragma omp target
5531 #pragma omp teams
5532 #pragma omp distribute parallel for
5533   for (int i = 0; i < 10; ++i) {
5534 #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?}}
5535     for (int i = 0; i < 10; ++i)
5536       ;
5537   }
5538 #pragma omp target
5539 #pragma omp teams
5540 #pragma omp distribute parallel for
5541   for (int i = 0; i < 10; ++i) {
5542 #pragma omp simd
5543     for (int i = 0; i < 10; ++i)
5544       ;
5545   }
5546 #pragma omp target
5547 #pragma omp teams
5548 #pragma omp distribute parallel for
5549   for (int i = 0; i < 10; ++i) {
5550 #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?}}
5551     for (int i = 0; i < 10; ++i)
5552       ;
5553   }
5554 #pragma omp target
5555 #pragma omp teams
5556 #pragma omp distribute parallel for
5557   for (int i = 0; i < 10; ++i) {
5558 #pragma omp parallel
5559     for (int i = 0; i < 10; ++i)
5560       ;
5561   }
5562 #pragma omp target
5563 #pragma omp teams
5564 #pragma omp distribute parallel for
5565   for (int i = 0; i < 10; ++i) {
5566 #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?}}
5567     {
5568       bar();
5569     }
5570   }
5571 #pragma omp target
5572 #pragma omp teams
5573 #pragma omp distribute parallel for
5574   for (int i = 0; i < 10; ++i) {
5575 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute parallel for region}}
5576     {
5577       bar();
5578     }
5579   }
5580 #pragma omp target
5581 #pragma omp teams
5582 #pragma omp distribute parallel for
5583   for (int i = 0; i < 10; ++i) {
5584 #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?}}
5585     {
5586       bar();
5587     }
5588   }
5589 #pragma omp target
5590 #pragma omp teams
5591 #pragma omp distribute parallel for
5592   for (int i = 0; i < 10; ++i) {
5593 #pragma omp master // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}}
5594     {
5595       bar();
5596     }
5597   }
5598 #pragma omp target
5599 #pragma omp teams
5600 #pragma omp distribute parallel for
5601   for (int i = 0; i < 10; ++i) {
5602 #pragma omp critical
5603     {
5604       bar();
5605     }
5606   }
5607 #pragma omp target
5608 #pragma omp teams
5609 #pragma omp distribute parallel for
5610   for (int i = 0; i < 10; ++i) {
5611 #pragma omp parallel
5612     {
5613 #pragma omp single
5614       {
5615 	bar();
5616       }
5617     }
5618   }
5619 #pragma omp target
5620 #pragma omp teams
5621 #pragma omp distribute parallel for
5622   for (int i = 0; i < 10; ++i) {
5623 #pragma omp parallel for
5624     for (int i = 0; i < 10; ++i)
5625       ;
5626   }
5627 #pragma omp target
5628 #pragma omp teams
5629 #pragma omp distribute parallel for
5630   for (int i = 0; i < 10; ++i) {
5631 #pragma omp parallel for simd
5632     for (int i = 0; i < 10; ++i)
5633       ;
5634   }
5635 #pragma omp target
5636 #pragma omp teams
5637 #pragma omp distribute parallel for
5638   for (int i = 0; i < 10; ++i) {
5639 #pragma omp parallel sections
5640     {
5641       bar();
5642     }
5643   }
5644 #pragma omp target
5645 #pragma omp teams
5646 #pragma omp distribute parallel for
5647   for (int i = 0; i < 10; ++i) {
5648 #pragma omp task
5649     {
5650       bar();
5651     }
5652   }
5653 #pragma omp target
5654 #pragma omp teams
5655 #pragma omp distribute parallel for
5656   for (int i = 0; i < 10; ++i) {
5657 #pragma omp taskyield
5658     bar();
5659   }
5660 #pragma omp target
5661 #pragma omp teams
5662 #pragma omp distribute parallel for
5663   for (int i = 0; i < 10; ++i) {
5664 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}}
5665     bar();
5666   }
5667 #pragma omp target
5668 #pragma omp teams
5669 #pragma omp distribute parallel for
5670   for (int i = 0; i < 10; ++i) {
5671 #pragma omp taskwait
5672     bar();
5673   }
5674 #pragma omp target
5675 #pragma omp teams
5676 #pragma omp distribute parallel for
5677   for (int i = 0; i < 10; ++i) {
5678 #pragma omp flush
5679     bar();
5680   }
5681 #pragma omp target
5682 #pragma omp teams
5683 #pragma omp distribute parallel for
5684   for (int i = 0; i < 10; ++i) {
5685 #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?}}
5686     bar();
5687   }
5688 #pragma omp target
5689 #pragma omp teams
5690 #pragma omp distribute parallel for
5691   for (int i = 0; i < 10; ++i) {
5692 #pragma omp atomic
5693     ++a;
5694   }
5695 #pragma omp target
5696 #pragma omp teams
5697 #pragma omp distribute parallel for
5698   for (int i = 0; i < 10; ++i) {
5699 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
5700     ++a;
5701   }
5702 #pragma omp target
5703 #pragma omp teams
5704 #pragma omp distribute parallel for
5705   for (int i = 0; i < 10; ++i) {
5706 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
5707     ++a;
5708   }
5709 #pragma omp target
5710 #pragma omp teams
5711 #pragma omp distribute parallel for
5712   for (int i = 0; i < 10; ++i) {
5713 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
5714     for (int i = 0; i < 10; ++i)
5715       ;
5716   }
5717 #pragma omp target
5718 #pragma omp teams
5719 #pragma omp distribute parallel for
5720   for (int i = 0; i < 10; ++i) {
5721 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
5722     ++a;
5723   }
5724 #pragma omp target
5725 #pragma omp teams
5726 #pragma omp distribute parallel for
5727   for (int i = 0; i < 10; ++i) {
5728 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
5729     ++a;
5730   }
5731 #pragma omp target
5732 #pragma omp teams
5733 #pragma omp distribute parallel for
5734   for (int i = 0; i < 10; ++i) {
5735 #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?}}
5736     ++a;
5737   }
5738 #pragma omp target
5739 #pragma omp teams
5740 #pragma omp distribute parallel for
5741   for (int i = 0; i < 10; ++i) {
5742 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
5743     ++a;
5744   }
5745 #pragma omp target
5746 #pragma omp teams
5747 #pragma omp distribute parallel for
5748   for (int i = 0; i < 10; ++i) {
5749 #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?}}
5750     for (int i = 0; i < 10; ++i)
5751       ;
5752   }
5753 #pragma omp target
5754 #pragma omp teams
5755 #pragma omp distribute parallel for
5756   for (int i = 0; i < 10; ++i) {
5757 #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?}}
5758     for (int i = 0; i < 10; ++i)
5759       ;
5760   }
5761 #pragma omp target
5762 #pragma omp teams
5763 #pragma omp distribute parallel for
5764   for (int i = 0; i < 10; ++i) {
5765 #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?}}
5766     for (int i = 0; i < 10; ++i)
5767       ;
5768   }
5769 #pragma omp target
5770 #pragma omp teams
5771 #pragma omp distribute parallel for
5772   for (int i = 0; i < 10; ++i) {
5773 #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?}}
5774     for (int i = 0; i < 10; ++i)
5775       ;
5776   }
5777 #pragma omp target
5778 #pragma omp teams
5779 #pragma omp distribute parallel for
5780   for (int i = 0; i < 10; ++i) {
5781 #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?}}
5782     for (int i = 0; i < 10; ++i)
5783       ;
5784   }
5785 #pragma omp target
5786 #pragma omp teams
5787 #pragma omp distribute parallel for
5788   for (int i = 0; i < 10; ++i) {
5789 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
5790     a++;
5791   }
5792 #pragma omp target
5793 #pragma omp teams
5794 #pragma omp distribute parallel for
5795   for (int i = 0; i < 10; ++i) {
5796 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
5797     for (int i = 0; i < 10; ++i)
5798       ;
5799   }
5800 #pragma omp target
5801 #pragma omp teams
5802 #pragma omp distribute parallel for
5803   for (int i = 0; i < 10; ++i) {
5804 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
5805     for (int i = 0; i < 10; ++i)
5806       ;
5807   }
5808 #pragma omp target
5809 #pragma omp teams
5810 #pragma omp distribute parallel for
5811   for (int i = 0; i < 10; ++i) {
5812 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
5813     for (int i = 0; i < 10; ++i)
5814       ;
5815   }
5816 #pragma omp target
5817 #pragma omp teams
5818 #pragma omp distribute parallel for
5819   for (int i = 0; i < 10; ++i) {
5820 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
5821     for (int i = 0; i < 10; ++i)
5822       ;
5823   }
5824 
5825 // DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
5826 #pragma omp target
5827 #pragma omp teams
5828 #pragma omp distribute parallel for simd
5829   for (int i = 0; i < 10; ++i) {
5830 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5831     for (int i = 0; i < 10; ++i)
5832       ;
5833   }
5834 #pragma omp target
5835 #pragma omp teams
5836 #pragma omp distribute parallel for simd
5837   for (int i = 0; i < 10; ++i) {
5838 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5839     for (int i = 0; i < 10; ++i)
5840       ;
5841   }
5842 #pragma omp target
5843 #pragma omp teams
5844 #pragma omp distribute parallel for simd
5845   for (int i = 0; i < 10; ++i) {
5846 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5847     for (int i = 0; i < 10; ++i)
5848       ;
5849   }
5850 #pragma omp target
5851 #pragma omp teams
5852 #pragma omp distribute parallel for simd
5853   for (int i = 0; i < 10; ++i) {
5854 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
5855     for (int i = 0; i < 10; ++i)
5856       ;
5857   }
5858 #pragma omp target
5859 #pragma omp teams
5860 #pragma omp distribute parallel for simd
5861   for (int i = 0; i < 10; ++i) {
5862 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5863     for (int i = 0; i < 10; ++i)
5864       ;
5865   }
5866 #pragma omp target
5867 #pragma omp teams
5868 #pragma omp distribute parallel for simd
5869   for (int i = 0; i < 10; ++i) {
5870 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5871     for (int i = 0; i < 10; ++i)
5872       ;
5873   }
5874 #pragma omp target
5875 #pragma omp teams
5876 #pragma omp distribute parallel for simd
5877   for (int i = 0; i < 10; ++i) {
5878 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5879     {
5880       bar();
5881     }
5882   }
5883 #pragma omp target
5884 #pragma omp teams
5885 #pragma omp distribute parallel for simd
5886   for (int i = 0; i < 10; ++i) {
5887 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5888     {
5889       bar();
5890     }
5891   }
5892 #pragma omp target
5893 #pragma omp teams
5894 #pragma omp distribute parallel for simd
5895   for (int i = 0; i < 10; ++i) {
5896 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5897     {
5898       bar();
5899     }
5900   }
5901 #pragma omp target
5902 #pragma omp teams
5903 #pragma omp distribute parallel for simd
5904   for (int i = 0; i < 10; ++i) {
5905 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5906     {
5907       bar();
5908     }
5909   }
5910 #pragma omp target
5911 #pragma omp teams
5912 #pragma omp distribute parallel for simd
5913   for (int i = 0; i < 10; ++i) {
5914 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5915     {
5916       bar();
5917     }
5918   }
5919 #pragma omp target
5920 #pragma omp teams
5921 #pragma omp distribute parallel for simd
5922   for (int i = 0; i < 10; ++i) {
5923 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5924     {
5925 #pragma omp single
5926       {
5927 	bar();
5928       }
5929     }
5930   }
5931 #pragma omp target
5932 #pragma omp teams
5933 #pragma omp distribute parallel for simd
5934   for (int i = 0; i < 10; ++i) {
5935 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5936     for (int i = 0; i < 10; ++i)
5937       ;
5938   }
5939 #pragma omp target
5940 #pragma omp teams
5941 #pragma omp distribute parallel for simd
5942   for (int i = 0; i < 10; ++i) {
5943 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5944     for (int i = 0; i < 10; ++i)
5945       ;
5946   }
5947 #pragma omp target
5948 #pragma omp teams
5949 #pragma omp distribute parallel for simd
5950   for (int i = 0; i < 10; ++i) {
5951 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5952     {
5953       bar();
5954     }
5955   }
5956 #pragma omp target
5957 #pragma omp teams
5958 #pragma omp distribute parallel for simd
5959   for (int i = 0; i < 10; ++i) {
5960 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5961     {
5962       bar();
5963     }
5964   }
5965 #pragma omp target
5966 #pragma omp teams
5967 #pragma omp distribute parallel for simd
5968   for (int i = 0; i < 10; ++i) {
5969 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5970     bar();
5971   }
5972 #pragma omp target
5973 #pragma omp teams
5974 #pragma omp distribute parallel for simd
5975   for (int i = 0; i < 10; ++i) {
5976 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5977     bar();
5978   }
5979 #pragma omp target
5980 #pragma omp teams
5981 #pragma omp distribute parallel for simd
5982   for (int i = 0; i < 10; ++i) {
5983 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5984     bar();
5985   }
5986 #pragma omp target
5987 #pragma omp teams
5988 #pragma omp distribute parallel for simd
5989   for (int i = 0; i < 10; ++i) {
5990 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5991     bar();
5992   }
5993 #pragma omp target
5994 #pragma omp teams
5995 #pragma omp distribute parallel for simd
5996   for (int i = 0; i < 10; ++i) {
5997 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
5998     bar();
5999   }
6000 #pragma omp target
6001 #pragma omp teams
6002 #pragma omp distribute parallel for simd
6003   for (int i = 0; i < 10; ++i) {
6004 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6005     ++a;
6006   }
6007 #pragma omp target
6008 #pragma omp teams
6009 #pragma omp distribute parallel for simd
6010   for (int i = 0; i < 10; ++i) {
6011 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6012     ++a;
6013   }
6014 #pragma omp target
6015 #pragma omp teams
6016 #pragma omp distribute parallel for simd
6017   for (int i = 0; i < 10; ++i) {
6018 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6019     ++a;
6020   }
6021 #pragma omp target
6022 #pragma omp teams
6023 #pragma omp distribute parallel for simd
6024   for (int i = 0; i < 10; ++i) {
6025 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6026     for (int i = 0; i < 10; ++i)
6027       ;
6028   }
6029 #pragma omp target
6030 #pragma omp teams
6031 #pragma omp distribute parallel for simd
6032   for (int i = 0; i < 10; ++i) {
6033 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6034     ++a;
6035   }
6036 #pragma omp target
6037 #pragma omp teams
6038 #pragma omp distribute parallel for simd
6039   for (int i = 0; i < 10; ++i) {
6040 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6041     ++a;
6042   }
6043 #pragma omp target
6044 #pragma omp teams
6045 #pragma omp distribute parallel for simd
6046   for (int i = 0; i < 10; ++i) {
6047 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6048     ++a;
6049   }
6050 #pragma omp target
6051 #pragma omp teams
6052 #pragma omp distribute parallel for simd
6053   for (int i = 0; i < 10; ++i) {
6054 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6055     ++a;
6056   }
6057 #pragma omp target
6058 #pragma omp teams
6059 #pragma omp distribute parallel for simd
6060   for (int i = 0; i < 10; ++i) {
6061 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6062     for (int i = 0; i < 10; ++i)
6063       ++a;
6064   }
6065 #pragma omp target
6066 #pragma omp teams
6067 #pragma omp distribute parallel for simd
6068   for (int i = 0; i < 10; ++i) {
6069 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6070     for (int i = 0; i < 10; ++i)
6071       ++a;
6072   }
6073 #pragma omp target
6074 #pragma omp teams
6075 #pragma omp distribute parallel for simd
6076   for (int i = 0; i < 10; ++i) {
6077 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6078     for (int i = 0; i < 10; ++i)
6079       ++a;
6080   }
6081 #pragma omp target
6082 #pragma omp teams
6083 #pragma omp distribute parallel for simd
6084   for (int i = 0; i < 10; ++i) {
6085 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6086     for (int i = 0; i < 10; ++i)
6087       ++a;
6088   }
6089 #pragma omp target
6090 #pragma omp teams
6091 #pragma omp distribute parallel for simd
6092   for (int i = 0; i < 10; ++i) {
6093 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6094     for (int i = 0; i < 10; ++i)
6095       ++a;
6096   }
6097 #pragma omp target
6098 #pragma omp teams
6099 #pragma omp distribute parallel for simd
6100   for (int i = 0; i < 10; ++i) {
6101 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6102     for (int i = 0; i < 10; ++i)
6103       ++a;
6104   }
6105 #pragma omp target
6106 #pragma omp teams
6107 #pragma omp distribute parallel for simd
6108   for (int i = 0; i < 10; ++i) {
6109 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6110     ++a;
6111   }
6112 #pragma omp target
6113 #pragma omp teams
6114 #pragma omp distribute parallel for simd
6115   for (int i = 0; i < 10; ++i) {
6116 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6117     for (int i = 0; i < 10; ++i)
6118       ++a;
6119   }
6120 #pragma omp target
6121 #pragma omp teams
6122 #pragma omp distribute parallel for simd
6123   for (int i = 0; i < 10; ++i) {
6124 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6125     for (int i = 0; i < 10; ++i)
6126       ++a;
6127   }
6128 #pragma omp target
6129 #pragma omp teams
6130 #pragma omp distribute parallel for simd
6131   for (int i = 0; i < 10; ++i) {
6132 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6133     for (int i = 0; i < 10; ++i)
6134       ++a;
6135   }
6136 #pragma omp target
6137 #pragma omp teams
6138 #pragma omp distribute parallel for simd
6139   for (int i = 0; i < 10; ++i) {
6140 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6141     for (int i = 0; i < 10; ++i)
6142       ++a;
6143   }
6144 
6145 // TARGET SIMD DIRECTIVE
6146 #pragma omp target simd
6147   for (int i = 0; i < 10; ++i) {
6148 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6149     for (int i = 0; i < 10; ++i)
6150       ;
6151   }
6152 #pragma omp target simd
6153   for (int i = 0; i < 10; ++i) {
6154 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6155     for (int i = 0; i < 10; ++i)
6156       ;
6157   }
6158 #pragma omp target simd
6159   for (int i = 0; i < 10; ++i) {
6160 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6161     for (int i = 0; i < 10; ++i)
6162       ;
6163   }
6164 #pragma omp target simd
6165   for (int i = 0; i < 10; ++i) {
6166 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
6167     for (int i = 0; i < 10; ++i)
6168       ;
6169   }
6170 #pragma omp target simd
6171   for (int i = 0; i < 10; ++i) {
6172 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6173     for (int i = 0; i < 10; ++i)
6174       ;
6175   }
6176 #pragma omp target simd
6177   for (int i = 0; i < 10; ++i) {
6178 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6179     for (int i = 0; i < 10; ++i)
6180       ;
6181   }
6182 #pragma omp target simd
6183   for (int i = 0; i < 10; ++i) {
6184 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6185     {
6186       bar();
6187     }
6188   }
6189 #pragma omp target simd
6190   for (int i = 0; i < 10; ++i) {
6191 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6192     {
6193       bar();
6194     }
6195   }
6196 #pragma omp target simd
6197   for (int i = 0; i < 10; ++i) {
6198 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6199     {
6200       bar();
6201     }
6202   }
6203 #pragma omp target simd
6204   for (int i = 0; i < 10; ++i) {
6205 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6206     {
6207       bar();
6208     }
6209   }
6210 #pragma omp target simd
6211   for (int i = 0; i < 10; ++i) {
6212 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6213     {
6214       bar();
6215     }
6216   }
6217 #pragma omp target simd
6218   for (int i = 0; i < 10; ++i) {
6219 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6220     {
6221 #pragma omp single
6222       {
6223 	bar();
6224       }
6225     }
6226   }
6227 #pragma omp target simd
6228   for (int i = 0; i < 10; ++i) {
6229 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6230     for (int i = 0; i < 10; ++i)
6231       ;
6232   }
6233 #pragma omp target simd
6234   for (int i = 0; i < 10; ++i) {
6235 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6236     for (int i = 0; i < 10; ++i)
6237       ;
6238   }
6239 #pragma omp target simd
6240   for (int i = 0; i < 10; ++i) {
6241 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6242     {
6243       bar();
6244     }
6245   }
6246 #pragma omp target simd
6247   for (int i = 0; i < 10; ++i) {
6248 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6249     {
6250       bar();
6251     }
6252   }
6253 #pragma omp target simd
6254   for (int i = 0; i < 10; ++i) {
6255 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6256     bar();
6257   }
6258 #pragma omp target simd
6259   for (int i = 0; i < 10; ++i) {
6260 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6261     bar();
6262   }
6263 #pragma omp target simd
6264   for (int i = 0; i < 10; ++i) {
6265 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6266     bar();
6267   }
6268 #pragma omp target simd
6269   for (int i = 0; i < 10; ++i) {
6270 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6271     bar();
6272   }
6273 #pragma omp target simd
6274   for (int i = 0; i < 10; ++i) {
6275 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6276     bar();
6277   }
6278 #pragma omp target simd
6279   for (int i = 0; i < 10; ++i) {
6280 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6281     ++a;
6282   }
6283 #pragma omp target simd
6284   for (int i = 0; i < 10; ++i) {
6285 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6286     ++a;
6287   }
6288 #pragma omp target simd
6289   for (int i = 0; i < 10; ++i) {
6290 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6291     ++a;
6292   }
6293 #pragma omp target simd
6294   for (int i = 0; i < 10; ++i) {
6295 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6296     for (int i = 0; i < 10; ++i)
6297       ;
6298   }
6299 #pragma omp target simd
6300   for (int i = 0; i < 10; ++i) {
6301 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6302     ++a;
6303   }
6304 #pragma omp target simd
6305   for (int i = 0; i < 10; ++i) {
6306 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6307     ++a;
6308   }
6309 #pragma omp target simd
6310   for (int i = 0; i < 10; ++i) {
6311 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6312     ++a;
6313   }
6314 #pragma omp target simd
6315   for (int i = 0; i < 10; ++i) {
6316 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6317     ++a;
6318   }
6319 #pragma omp target simd
6320   for (int i = 0; i < 10; ++i) {
6321 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6322     for (int i = 0; i < 10; ++i)
6323       ++a;
6324   }
6325 #pragma omp target simd
6326   for (int i = 0; i < 10; ++i) {
6327 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6328     for (int i = 0; i < 10; ++i)
6329       ++a;
6330   }
6331 #pragma omp target simd
6332   for (int i = 0; i < 10; ++i) {
6333 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6334     for (int i = 0; i < 10; ++i)
6335       ++a;
6336   }
6337 #pragma omp target simd
6338   for (int i = 0; i < 10; ++i) {
6339 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6340     for (int i = 0; i < 10; ++i)
6341       ++a;
6342   }
6343 #pragma omp target simd
6344   for (int i = 0; i < 10; ++i) {
6345 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6346     for (int i = 0; i < 10; ++i)
6347       ++a;
6348   }
6349 #pragma omp target simd
6350   for (int i = 0; i < 10; ++i) {
6351 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6352     for (int i = 0; i < 10; ++i)
6353       ++a;
6354   }
6355 #pragma omp target simd
6356   for (int i = 0; i < 10; ++i) {
6357 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6358     for (int i = 0; i < 10; ++i)
6359       ++a;
6360   }
6361 #pragma omp target simd
6362   for (int i = 0; i < 10; ++i) {
6363 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6364     for (int i = 0; i < 10; ++i)
6365       ++a;
6366   }
6367 
6368 // TEAMS DISTRIBUTE DIRECTIVE
6369 #pragma omp teams distribute // expected-error {{orphaned 'omp teams distribute' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
6370   for (int i = 0; i < 10; ++i)
6371     ;
6372 #pragma omp target
6373 #pragma omp teams distribute
6374   for (int i = 0; i < 10; ++i) {
6375 #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?}}
6376     for (int i = 0; i < 10; ++i)
6377       ;
6378   }
6379 #pragma omp target
6380 #pragma omp teams distribute
6381   for (int i = 0; i < 10; ++i) {
6382 #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?}}
6383     for (int i = 0; i < 10; ++i)
6384       ;
6385   }
6386 #pragma omp target
6387 #pragma omp teams distribute
6388   for (int i = 0; i < 10; ++i) {
6389 #pragma omp for // OK
6390     for (int i = 0; i < 10; ++i)
6391       ;
6392   }
6393 #pragma omp target
6394 #pragma omp teams distribute
6395   for (int i = 0; i < 10; ++i) {
6396 #pragma omp simd // OK
6397     for (int i = 0; i < 10; ++i)
6398       ;
6399   }
6400 #pragma omp target
6401 #pragma omp teams distribute
6402   for (int i = 0; i < 10; ++i) {
6403 #pragma omp for simd // OK
6404     for (int i = 0; i < 10; ++i)
6405       ;
6406   }
6407 #pragma omp target
6408 #pragma omp teams distribute
6409   for (int i = 0; i < 10; ++i) {
6410 #pragma omp parallel // OK
6411     for (int i = 0; i < 10; ++i)
6412       ;
6413   }
6414 #pragma omp target
6415 #pragma omp teams distribute
6416   for (int i = 0; i < 10; ++i) {
6417 #pragma omp sections // OK
6418     {
6419       bar();
6420     }
6421   }
6422 #pragma omp target
6423 #pragma omp teams distribute
6424   for (int i = 0; i < 10; ++i) {
6425 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute region}}
6426     {
6427       bar();
6428     }
6429   }
6430 #pragma omp target
6431 #pragma omp teams distribute
6432   for (int i = 0; i < 10; ++i) {
6433 #pragma omp single // OK
6434     {
6435       bar();
6436     }
6437   }
6438 #pragma omp target
6439 #pragma omp teams distribute
6440   for (int i = 0; i < 10; ++i) {
6441 #pragma omp master // OK
6442     {
6443       bar();
6444     }
6445   }
6446 #pragma omp target
6447 #pragma omp teams distribute
6448   for (int i = 0; i < 10; ++i) {
6449 #pragma omp critical // OK
6450     {
6451       bar();
6452     }
6453   }
6454 #pragma omp target
6455 #pragma omp teams distribute
6456   for (int i = 0; i < 10; ++i) {
6457 #pragma omp parallel // OK
6458     {
6459 #pragma omp single
6460       {
6461 	bar();
6462       }
6463     }
6464   }
6465 #pragma omp target
6466 #pragma omp teams distribute
6467   for (int i = 0; i < 10; ++i) {
6468 #pragma omp parallel for // OK
6469     for (int i = 0; i < 10; ++i)
6470       ;
6471   }
6472 #pragma omp target
6473 #pragma omp teams distribute
6474   for (int i = 0; i < 10; ++i) {
6475 #pragma omp parallel for simd // OK
6476     for (int i = 0; i < 10; ++i)
6477       ;
6478   }
6479 #pragma omp target
6480 #pragma omp teams distribute
6481   for (int i = 0; i < 10; ++i) {
6482 #pragma omp parallel sections // OK
6483     {
6484       bar();
6485     }
6486   }
6487 #pragma omp target
6488 #pragma omp teams distribute
6489   for (int i = 0; i < 10; ++i) {
6490 #pragma omp task // OK
6491     {
6492       bar();
6493     }
6494   }
6495 #pragma omp target
6496 #pragma omp teams distribute
6497   for (int i = 0; i < 10; ++i) {
6498 #pragma omp taskyield // OK
6499     bar();
6500   }
6501 #pragma omp target
6502 #pragma omp teams distribute
6503   for (int i = 0; i < 10; ++i) {
6504 #pragma omp barrier // OK
6505     bar();
6506   }
6507 #pragma omp target
6508 #pragma omp teams distribute
6509   for (int i = 0; i < 10; ++i) {
6510 #pragma omp taskwait // OK
6511     bar();
6512   }
6513 #pragma omp target
6514 #pragma omp teams distribute
6515   for (int i = 0; i < 10; ++i) {
6516 #pragma omp flush // OK
6517     bar();
6518   }
6519 #pragma omp target
6520 #pragma omp teams distribute
6521   for (int i = 0; i < 10; ++i) {
6522 #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?}}
6523     bar();
6524   }
6525 #pragma omp target
6526 #pragma omp teams distribute
6527   for (int i = 0; i < 10; ++i) {
6528 #pragma omp atomic // OK
6529     ++a;
6530   }
6531 #pragma omp target
6532 #pragma omp teams distribute
6533   for (int i = 0; i < 10; ++i) {
6534 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
6535     ++a;
6536   }
6537 #pragma omp target
6538 #pragma omp teams distribute
6539   for (int i = 0; i < 10; ++i) {
6540 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
6541     ++a;
6542   }
6543 #pragma omp target
6544 #pragma omp teams distribute
6545   for (int i = 0; i < 10; ++i) {
6546 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
6547     for (int i = 0; i < 10; ++i)
6548       ;
6549   }
6550 #pragma omp target
6551 #pragma omp teams distribute
6552   for (int i = 0; i < 10; ++i) {
6553 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
6554     ++a;
6555   }
6556 #pragma omp target
6557 #pragma omp teams distribute
6558   for (int i = 0; i < 10; ++i) {
6559 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
6560     ++a;
6561   }
6562 #pragma omp target
6563 #pragma omp teams distribute
6564   for (int i = 0; i < 10; ++i) {
6565 #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?}}
6566     ++a;
6567   }
6568 #pragma omp target
6569 #pragma omp teams distribute
6570   for (int i = 0; i < 10; ++i) {
6571 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
6572     ++a;
6573   }
6574 #pragma omp target
6575 #pragma omp teams distribute
6576   for (int i = 0; i < 10; ++i) {
6577 #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?}}
6578     for (int i = 0; i < 10; ++i)
6579       ++a;
6580   }
6581 #pragma omp target
6582 #pragma omp teams distribute
6583   for (int i = 0; i < 10; ++i) {
6584 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
6585     for (int i = 0; i < 10; ++i)
6586       ++a;
6587   }
6588 #pragma omp target
6589 #pragma omp teams distribute
6590   for (int i = 0; i < 10; ++i) {
6591 #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?}}
6592     for (int i = 0; i < 10; ++i)
6593       ++a;
6594   }
6595 #pragma omp target
6596 #pragma omp teams distribute
6597   for (int i = 0; i < 10; ++i) {
6598 #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?}}
6599     for (int i = 0; i < 10; ++i)
6600       ++a;
6601   }
6602 #pragma omp target
6603 #pragma omp teams distribute
6604   for (int i = 0; i < 10; ++i) {
6605 #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?}}
6606     for (int i = 0; i < 10; ++i)
6607       ++a;
6608   }
6609 #pragma omp target
6610 #pragma omp teams distribute
6611   for (int i = 0; i < 10; ++i) {
6612 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
6613     for (int i = 0; i < 10; ++i)
6614       ++a;
6615   }
6616 #pragma omp target
6617 #pragma omp teams distribute
6618   for (int i = 0; i < 10; ++i) {
6619 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
6620     for (int i = 0; i < 10; ++i)
6621       ++a;
6622   }
6623 #pragma omp target
6624 #pragma omp teams distribute
6625   for (int i = 0; i < 10; ++i) {
6626 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
6627     for (int i = 0; i < 10; ++i)
6628       ++a;
6629   }
6630 
6631 // TEAMS DISTRIBUTE DIRECTIVE
6632 #pragma omp teams distribute // expected-error {{orphaned 'omp teams distribute' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
6633   for (int i = 0; i < 10; ++i)
6634     ;
6635 #pragma omp target
6636 #pragma omp teams distribute
6637   for (int i = 0; i < 10; ++i) {
6638 #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?}}
6639     for (int i = 0; i < 10; ++i)
6640       ;
6641   }
6642 #pragma omp target
6643 #pragma omp teams distribute
6644   for (int i = 0; i < 10; ++i) {
6645 #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?}}
6646     for (int i = 0; i < 10; ++i)
6647       ;
6648   }
6649 #pragma omp target
6650 #pragma omp teams distribute
6651   for (int i = 0; i < 10; ++i) {
6652 #pragma omp for // OK
6653     for (int i = 0; i < 10; ++i)
6654       ;
6655   }
6656 #pragma omp target
6657 #pragma omp teams distribute
6658   for (int i = 0; i < 10; ++i) {
6659 #pragma omp simd // OK
6660     for (int i = 0; i < 10; ++i)
6661       ;
6662   }
6663 #pragma omp target
6664 #pragma omp teams distribute
6665   for (int i = 0; i < 10; ++i) {
6666 #pragma omp for simd // OK
6667     for (int i = 0; i < 10; ++i)
6668       ;
6669   }
6670 #pragma omp target
6671 #pragma omp teams distribute
6672   for (int i = 0; i < 10; ++i) {
6673 #pragma omp parallel // OK
6674     for (int i = 0; i < 10; ++i)
6675       ;
6676   }
6677 #pragma omp target
6678 #pragma omp teams distribute
6679   for (int i = 0; i < 10; ++i) {
6680 #pragma omp sections // OK
6681     {
6682       bar();
6683     }
6684   }
6685 #pragma omp target
6686 #pragma omp teams distribute
6687   for (int i = 0; i < 10; ++i) {
6688 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute region}}
6689     {
6690       bar();
6691     }
6692   }
6693 #pragma omp target
6694 #pragma omp teams distribute
6695   for (int i = 0; i < 10; ++i) {
6696 #pragma omp single // OK
6697     {
6698       bar();
6699     }
6700   }
6701 #pragma omp target
6702 #pragma omp teams distribute
6703   for (int i = 0; i < 10; ++i) {
6704 #pragma omp master // OK
6705     {
6706       bar();
6707     }
6708   }
6709 #pragma omp target
6710 #pragma omp teams distribute
6711   for (int i = 0; i < 10; ++i) {
6712 #pragma omp critical // OK
6713     {
6714       bar();
6715     }
6716   }
6717 #pragma omp target
6718 #pragma omp teams distribute
6719   for (int i = 0; i < 10; ++i) {
6720 #pragma omp parallel // OK
6721     {
6722 #pragma omp single
6723       {
6724 	bar();
6725       }
6726     }
6727   }
6728 #pragma omp target
6729 #pragma omp teams distribute
6730   for (int i = 0; i < 10; ++i) {
6731 #pragma omp parallel for // OK
6732     for (int i = 0; i < 10; ++i)
6733       ;
6734   }
6735 #pragma omp target
6736 #pragma omp teams distribute
6737   for (int i = 0; i < 10; ++i) {
6738 #pragma omp parallel for simd // OK
6739     for (int i = 0; i < 10; ++i)
6740       ;
6741   }
6742 #pragma omp target
6743 #pragma omp teams distribute
6744   for (int i = 0; i < 10; ++i) {
6745 #pragma omp parallel sections // OK
6746     {
6747       bar();
6748     }
6749   }
6750 #pragma omp target
6751 #pragma omp teams distribute
6752   for (int i = 0; i < 10; ++i) {
6753 #pragma omp task // OK
6754     {
6755       bar();
6756     }
6757   }
6758 #pragma omp target
6759 #pragma omp teams distribute
6760   for (int i = 0; i < 10; ++i) {
6761 #pragma omp taskyield // OK
6762     bar();
6763   }
6764 #pragma omp target
6765 #pragma omp teams distribute
6766   for (int i = 0; i < 10; ++i) {
6767 #pragma omp barrier // OK
6768     bar();
6769   }
6770 #pragma omp target
6771 #pragma omp teams distribute
6772   for (int i = 0; i < 10; ++i) {
6773 #pragma omp taskwait // OK
6774     bar();
6775   }
6776 #pragma omp target
6777 #pragma omp teams distribute
6778   for (int i = 0; i < 10; ++i) {
6779 #pragma omp flush // OK
6780     bar();
6781   }
6782 #pragma omp target
6783 #pragma omp teams distribute
6784   for (int i = 0; i < 10; ++i) {
6785 #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?}}
6786     bar();
6787   }
6788 #pragma omp target
6789 #pragma omp teams distribute
6790   for (int i = 0; i < 10; ++i) {
6791 #pragma omp atomic // OK
6792     ++a;
6793   }
6794 #pragma omp target
6795 #pragma omp teams distribute
6796   for (int i = 0; i < 10; ++i) {
6797 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
6798     ++a;
6799   }
6800 #pragma omp target
6801 #pragma omp teams distribute
6802   for (int i = 0; i < 10; ++i) {
6803 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
6804     ++a;
6805   }
6806 #pragma omp target
6807 #pragma omp teams distribute
6808   for (int i = 0; i < 10; ++i) {
6809 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
6810     for (int i = 0; i < 10; ++i)
6811       ;
6812   }
6813 #pragma omp target
6814 #pragma omp teams distribute
6815   for (int i = 0; i < 10; ++i) {
6816 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
6817     ++a;
6818   }
6819 #pragma omp target
6820 #pragma omp teams distribute
6821   for (int i = 0; i < 10; ++i) {
6822 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
6823     ++a;
6824   }
6825 #pragma omp target
6826 #pragma omp teams distribute
6827   for (int i = 0; i < 10; ++i) {
6828 #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?}}
6829     ++a;
6830   }
6831 #pragma omp target
6832 #pragma omp teams distribute
6833   for (int i = 0; i < 10; ++i) {
6834 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
6835     ++a;
6836   }
6837 #pragma omp target
6838 #pragma omp teams distribute
6839   for (int i = 0; i < 10; ++i) {
6840 #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?}}
6841     for (int i = 0; i < 10; ++i)
6842       ++a;
6843   }
6844 #pragma omp target
6845 #pragma omp teams distribute
6846   for (int i = 0; i < 10; ++i) {
6847 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
6848     for (int i = 0; i < 10; ++i)
6849       ++a;
6850   }
6851 #pragma omp target
6852 #pragma omp teams distribute
6853   for (int i = 0; i < 10; ++i) {
6854 #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?}}
6855     for (int i = 0; i < 10; ++i)
6856       ++a;
6857   }
6858 #pragma omp target
6859 #pragma omp teams distribute
6860   for (int i = 0; i < 10; ++i) {
6861 #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?}}
6862     for (int i = 0; i < 10; ++i)
6863       ++a;
6864   }
6865 #pragma omp target
6866 #pragma omp teams distribute
6867   for (int i = 0; i < 10; ++i) {
6868 #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?}}
6869     for (int i = 0; i < 10; ++i)
6870       ++a;
6871   }
6872 #pragma omp target
6873 #pragma omp teams distribute
6874   for (int i = 0; i < 10; ++i) {
6875 #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?}}
6876     for (int i = 0; i < 10; ++i)
6877       ++a;
6878   }
6879 #pragma omp target
6880 #pragma omp teams distribute
6881   for (int i = 0; i < 10; ++i) {
6882 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
6883     ++a;
6884   }
6885 #pragma omp target
6886 #pragma omp teams distribute
6887   for (int i = 0; i < 10; ++i) {
6888 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
6889     for (int i = 0; i < 10; ++i)
6890       ++a;
6891   }
6892 #pragma omp target
6893 #pragma omp teams distribute
6894   for (int i = 0; i < 10; ++i) {
6895 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
6896     for (int i = 0; i < 10; ++i)
6897       ++a;
6898   }
6899 #pragma omp target
6900 #pragma omp teams distribute
6901   for (int i = 0; i < 10; ++i) {
6902 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
6903     for (int i = 0; i < 10; ++i)
6904       ++a;
6905   }
6906 #pragma omp target
6907 #pragma omp teams distribute
6908   for (int i = 0; i < 10; ++i) {
6909 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
6910     for (int i = 0; i < 10; ++i)
6911       ++a;
6912   }
6913 
6914 // TEAMS DISTRIBUTE SIMD DIRECTIVE
6915 #pragma omp teams distribute simd // expected-error {{orphaned 'omp teams distribute simd' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
6916   for (int i = 0; i < 10; ++i)
6917     ;
6918 #pragma omp target
6919 #pragma omp teams distribute simd
6920   for (int i = 0; i < 10; ++i) {
6921 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6922     for (int i = 0; i < 10; ++i)
6923       ;
6924   }
6925 #pragma omp target
6926 #pragma omp teams distribute simd
6927   for (int i = 0; i < 10; ++i) {
6928 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6929     for (int i = 0; i < 10; ++i)
6930       ;
6931   }
6932 #pragma omp target
6933 #pragma omp teams distribute simd
6934   for (int i = 0; i < 10; ++i) {
6935 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6936     for (int i = 0; i < 10; ++i)
6937       ;
6938   }
6939 #pragma omp target
6940 #pragma omp teams distribute simd
6941   for (int i = 0; i < 10; ++i) {
6942 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
6943     for (int i = 0; i < 10; ++i)
6944       ;
6945   }
6946 #pragma omp target
6947 #pragma omp teams distribute simd
6948   for (int i = 0; i < 10; ++i) {
6949 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6950     for (int i = 0; i < 10; ++i)
6951       ;
6952   }
6953 #pragma omp target
6954 #pragma omp teams distribute simd
6955   for (int i = 0; i < 10; ++i) {
6956 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6957     for (int i = 0; i < 10; ++i)
6958       ;
6959   }
6960 #pragma omp target
6961 #pragma omp teams distribute simd
6962   for (int i = 0; i < 10; ++i) {
6963 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6964     {
6965       bar();
6966     }
6967   }
6968 #pragma omp target
6969 #pragma omp teams distribute simd
6970   for (int i = 0; i < 10; ++i) {
6971 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6972     {
6973       bar();
6974     }
6975   }
6976 #pragma omp target
6977 #pragma omp teams distribute simd
6978   for (int i = 0; i < 10; ++i) {
6979 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6980     {
6981       bar();
6982     }
6983   }
6984 #pragma omp target
6985 #pragma omp teams distribute simd
6986   for (int i = 0; i < 10; ++i) {
6987 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6988     {
6989       bar();
6990     }
6991   }
6992 #pragma omp target
6993 #pragma omp teams distribute simd
6994   for (int i = 0; i < 10; ++i) {
6995 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
6996     {
6997       bar();
6998     }
6999   }
7000 #pragma omp target
7001 #pragma omp teams distribute simd
7002   for (int i = 0; i < 10; ++i) {
7003 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7004     {
7005 #pragma omp single
7006       {
7007 	bar();
7008       }
7009     }
7010   }
7011 #pragma omp target
7012 #pragma omp teams distribute simd
7013   for (int i = 0; i < 10; ++i) {
7014 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7015     for (int i = 0; i < 10; ++i)
7016       ;
7017   }
7018 #pragma omp target
7019 #pragma omp teams distribute simd
7020   for (int i = 0; i < 10; ++i) {
7021 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7022     for (int i = 0; i < 10; ++i)
7023       ;
7024   }
7025 #pragma omp target
7026 #pragma omp teams distribute simd
7027   for (int i = 0; i < 10; ++i) {
7028 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7029     {
7030       bar();
7031     }
7032   }
7033 #pragma omp target
7034 #pragma omp teams distribute simd
7035   for (int i = 0; i < 10; ++i) {
7036 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7037     {
7038       bar();
7039     }
7040   }
7041 #pragma omp target
7042 #pragma omp teams distribute simd
7043   for (int i = 0; i < 10; ++i) {
7044 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7045     bar();
7046   }
7047 #pragma omp target
7048 #pragma omp teams distribute simd
7049   for (int i = 0; i < 10; ++i) {
7050 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7051     bar();
7052   }
7053 #pragma omp target
7054 #pragma omp teams distribute simd
7055   for (int i = 0; i < 10; ++i) {
7056 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7057     bar();
7058   }
7059 #pragma omp target
7060 #pragma omp teams distribute simd
7061   for (int i = 0; i < 10; ++i) {
7062 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7063     bar();
7064   }
7065 #pragma omp target
7066 #pragma omp teams distribute simd
7067   for (int i = 0; i < 10; ++i) {
7068 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7069     bar();
7070   }
7071 #pragma omp target
7072 #pragma omp teams distribute simd
7073   for (int i = 0; i < 10; ++i) {
7074 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7075     ++a;
7076   }
7077 #pragma omp target
7078 #pragma omp teams distribute simd
7079   for (int i = 0; i < 10; ++i) {
7080 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7081     ++a;
7082   }
7083 #pragma omp target
7084 #pragma omp teams distribute simd
7085   for (int i = 0; i < 10; ++i) {
7086 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7087     ++a;
7088   }
7089 #pragma omp target
7090 #pragma omp teams distribute simd
7091   for (int i = 0; i < 10; ++i) {
7092 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7093     for (int i = 0; i < 10; ++i)
7094       ;
7095   }
7096 #pragma omp target
7097 #pragma omp teams distribute simd
7098   for (int i = 0; i < 10; ++i) {
7099 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7100     ++a;
7101   }
7102 #pragma omp target
7103 #pragma omp teams distribute simd
7104   for (int i = 0; i < 10; ++i) {
7105 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7106     ++a;
7107   }
7108 #pragma omp target
7109 #pragma omp teams distribute simd
7110   for (int i = 0; i < 10; ++i) {
7111 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7112     ++a;
7113   }
7114 #pragma omp target
7115 #pragma omp teams distribute simd
7116   for (int i = 0; i < 10; ++i) {
7117 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7118     ++a;
7119   }
7120 #pragma omp target
7121 #pragma omp teams distribute simd
7122   for (int i = 0; i < 10; ++i) {
7123 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7124     for (int i = 0; i < 10; ++i)
7125       ++a;
7126   }
7127 #pragma omp target
7128 #pragma omp teams distribute simd
7129   for (int i = 0; i < 10; ++i) {
7130 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7131     for (int i = 0; i < 10; ++i)
7132       ++a;
7133   }
7134 #pragma omp target
7135 #pragma omp teams distribute simd
7136   for (int i = 0; i < 10; ++i) {
7137 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7138     for (int i = 0; i < 10; ++i)
7139       ++a;
7140   }
7141 #pragma omp target
7142 #pragma omp teams distribute simd
7143   for (int i = 0; i < 10; ++i) {
7144 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7145     for (int i = 0; i < 10; ++i)
7146       ++a;
7147   }
7148 #pragma omp target
7149 #pragma omp teams distribute simd
7150   for (int i = 0; i < 10; ++i) {
7151 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7152     for (int i = 0; i < 10; ++i)
7153       ++a;
7154   }
7155 #pragma omp target
7156 #pragma omp teams distribute simd
7157   for (int i = 0; i < 10; ++i) {
7158 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7159     for (int i = 0; i < 10; ++i)
7160       ++a;
7161   }
7162 #pragma omp target
7163 #pragma omp teams distribute simd
7164   for (int i = 0; i < 10; ++i) {
7165 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7166     ++a;
7167   }
7168 #pragma omp target
7169 #pragma omp teams distribute simd
7170   for (int i = 0; i < 10; ++i) {
7171 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7172     for (int i = 0; i < 10; ++i)
7173       ++a;
7174   }
7175 #pragma omp target
7176 #pragma omp teams distribute simd
7177   for (int i = 0; i < 10; ++i) {
7178 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7179     for (int i = 0; i < 10; ++i)
7180       ++a;
7181   }
7182 #pragma omp target
7183 #pragma omp teams distribute simd
7184   for (int i = 0; i < 10; ++i) {
7185 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7186     for (int i = 0; i < 10; ++i)
7187       ++a;
7188   }
7189 #pragma omp target
7190 #pragma omp teams distribute simd
7191   for (int i = 0; i < 10; ++i) {
7192 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7193     for (int i = 0; i < 10; ++i)
7194       ++a;
7195   }
7196 
7197 // TEAMS DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
7198 #pragma omp teams distribute parallel for simd // expected-error {{orphaned 'omp teams distribute parallel for simd' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
7199   for (int i = 0; i < 10; ++i)
7200     ;
7201 #pragma omp target
7202 #pragma omp teams distribute parallel for simd
7203   for (int i = 0; i < 10; ++i) {
7204 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7205     for (int i = 0; i < 10; ++i)
7206       ;
7207   }
7208 #pragma omp target
7209 #pragma omp teams distribute parallel for simd
7210   for (int i = 0; i < 10; ++i) {
7211 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7212     for (int i = 0; i < 10; ++i)
7213       ;
7214   }
7215 #pragma omp target
7216 #pragma omp teams distribute parallel for simd
7217   for (int i = 0; i < 10; ++i) {
7218 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7219     for (int i = 0; i < 10; ++i)
7220       ;
7221   }
7222 #pragma omp target
7223 #pragma omp teams distribute parallel for simd
7224   for (int i = 0; i < 10; ++i) {
7225 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
7226     for (int i = 0; i < 10; ++i)
7227       ;
7228   }
7229 #pragma omp target
7230 #pragma omp teams distribute parallel for simd
7231   for (int i = 0; i < 10; ++i) {
7232 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7233     for (int i = 0; i < 10; ++i)
7234       ;
7235   }
7236 #pragma omp target
7237 #pragma omp teams distribute parallel for simd
7238   for (int i = 0; i < 10; ++i) {
7239 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7240     for (int i = 0; i < 10; ++i)
7241       ;
7242   }
7243 #pragma omp target
7244 #pragma omp teams distribute parallel for simd
7245   for (int i = 0; i < 10; ++i) {
7246 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7247     {
7248       bar();
7249     }
7250   }
7251 #pragma omp target
7252 #pragma omp teams distribute parallel for simd
7253   for (int i = 0; i < 10; ++i) {
7254 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7255     {
7256       bar();
7257     }
7258   }
7259 #pragma omp target
7260 #pragma omp teams distribute parallel for simd
7261   for (int i = 0; i < 10; ++i) {
7262 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7263     {
7264       bar();
7265     }
7266   }
7267 #pragma omp target
7268 #pragma omp teams distribute parallel for simd
7269   for (int i = 0; i < 10; ++i) {
7270 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7271     {
7272       bar();
7273     }
7274   }
7275 #pragma omp target
7276 #pragma omp teams distribute parallel for simd
7277   for (int i = 0; i < 10; ++i) {
7278 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7279     {
7280       bar();
7281     }
7282   }
7283 #pragma omp target
7284 #pragma omp teams distribute parallel for simd
7285   for (int i = 0; i < 10; ++i) {
7286 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7287     {
7288 #pragma omp single
7289       {
7290 	bar();
7291       }
7292     }
7293   }
7294 #pragma omp target
7295 #pragma omp teams distribute parallel for simd
7296   for (int i = 0; i < 10; ++i) {
7297 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7298     for (int i = 0; i < 10; ++i)
7299       ;
7300   }
7301 #pragma omp target
7302 #pragma omp teams distribute parallel for simd
7303   for (int i = 0; i < 10; ++i) {
7304 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7305     for (int i = 0; i < 10; ++i)
7306       ;
7307   }
7308 #pragma omp target
7309 #pragma omp teams distribute parallel for simd
7310   for (int i = 0; i < 10; ++i) {
7311 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7312     {
7313       bar();
7314     }
7315   }
7316 #pragma omp target
7317 #pragma omp teams distribute parallel for simd
7318   for (int i = 0; i < 10; ++i) {
7319 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7320     {
7321       bar();
7322     }
7323   }
7324 #pragma omp target
7325 #pragma omp teams distribute parallel for simd
7326   for (int i = 0; i < 10; ++i) {
7327 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7328     bar();
7329   }
7330 #pragma omp target
7331 #pragma omp teams distribute parallel for simd
7332   for (int i = 0; i < 10; ++i) {
7333 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7334     bar();
7335   }
7336 #pragma omp target
7337 #pragma omp teams distribute parallel for simd
7338   for (int i = 0; i < 10; ++i) {
7339 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7340     bar();
7341   }
7342 #pragma omp target
7343 #pragma omp teams distribute parallel for simd
7344   for (int i = 0; i < 10; ++i) {
7345 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7346     bar();
7347   }
7348 #pragma omp target
7349 #pragma omp teams distribute parallel for simd
7350   for (int i = 0; i < 10; ++i) {
7351 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7352     bar();
7353   }
7354 #pragma omp target
7355 #pragma omp teams distribute parallel for simd
7356   for (int i = 0; i < 10; ++i) {
7357 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7358     ++a;
7359   }
7360 #pragma omp target
7361 #pragma omp teams distribute parallel for simd
7362   for (int i = 0; i < 10; ++i) {
7363 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7364     ++a;
7365   }
7366 #pragma omp target
7367 #pragma omp teams distribute parallel for simd
7368   for (int i = 0; i < 10; ++i) {
7369 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7370     ++a;
7371   }
7372 #pragma omp target
7373 #pragma omp teams distribute parallel for simd
7374   for (int i = 0; i < 10; ++i) {
7375 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7376     for (int i = 0; i < 10; ++i)
7377       ;
7378   }
7379 #pragma omp target
7380 #pragma omp teams distribute parallel for simd
7381   for (int i = 0; i < 10; ++i) {
7382 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7383     ++a;
7384   }
7385 #pragma omp target
7386 #pragma omp teams distribute parallel for simd
7387   for (int i = 0; i < 10; ++i) {
7388 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7389     ++a;
7390   }
7391 #pragma omp target
7392 #pragma omp teams distribute parallel for simd
7393   for (int i = 0; i < 10; ++i) {
7394 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7395     ++a;
7396   }
7397 #pragma omp target
7398 #pragma omp teams distribute parallel for simd
7399   for (int i = 0; i < 10; ++i) {
7400 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7401     ++a;
7402   }
7403 #pragma omp target
7404 #pragma omp teams distribute parallel for simd
7405   for (int i = 0; i < 10; ++i) {
7406 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7407     for (int i = 0; i < 10; ++i)
7408       ++a;
7409   }
7410 #pragma omp target
7411 #pragma omp teams distribute parallel for simd
7412   for (int i = 0; i < 10; ++i) {
7413 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7414     for (int i = 0; i < 10; ++i)
7415       ++a;
7416   }
7417 #pragma omp target
7418 #pragma omp teams distribute parallel for simd
7419   for (int i = 0; i < 10; ++i) {
7420 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7421     for (int i = 0; i < 10; ++i)
7422       ++a;
7423   }
7424 #pragma omp target
7425 #pragma omp teams distribute parallel for simd
7426   for (int i = 0; i < 10; ++i) {
7427 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7428     for (int i = 0; i < 10; ++i)
7429       ++a;
7430   }
7431 #pragma omp target
7432 #pragma omp teams distribute parallel for simd
7433   for (int i = 0; i < 10; ++i) {
7434 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7435     for (int i = 0; i < 10; ++i)
7436       ++a;
7437   }
7438 #pragma omp target
7439 #pragma omp teams distribute parallel for simd
7440   for (int i = 0; i < 10; ++i) {
7441 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7442     for (int i = 0; i < 10; ++i)
7443       ++a;
7444   }
7445 #pragma omp target
7446 #pragma omp teams distribute parallel for simd
7447   for (int i = 0; i < 10; ++i) {
7448 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7449     ++a;
7450   }
7451 #pragma omp target
7452 #pragma omp teams distribute parallel for simd
7453   for (int i = 0; i < 10; ++i) {
7454 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7455     for (int i = 0; i < 10; ++i)
7456       ++a;
7457   }
7458 #pragma omp target
7459 #pragma omp teams distribute parallel for simd
7460   for (int i = 0; i < 10; ++i) {
7461 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7462     for (int i = 0; i < 10; ++i)
7463       ++a;
7464   }
7465 #pragma omp target
7466 #pragma omp teams distribute parallel for simd
7467   for (int i = 0; i < 10; ++i) {
7468 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7469     for (int i = 0; i < 10; ++i)
7470       ++a;
7471   }
7472 #pragma omp target
7473 #pragma omp teams distribute parallel for simd
7474   for (int i = 0; i < 10; ++i) {
7475 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
7476     for (int i = 0; i < 10; ++i)
7477       ++a;
7478   }
7479 
7480 // TEAMS DISTRIBUTE PARALLEL FOR DIRECTIVE
7481 #pragma omp teams distribute parallel for // expected-error {{orphaned 'omp teams distribute parallel for' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
7482   for (int i = 0; i < 10; ++i)
7483     ;
7484 #pragma omp target
7485 #pragma omp teams distribute parallel for
7486   for (int i = 0; i < 10; ++i) {
7487 #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?}}
7488     for (int i = 0; i < 10; ++i)
7489       ;
7490   }
7491 #pragma omp target
7492 #pragma omp teams distribute parallel for
7493   for (int i = 0; i < 10; ++i) {
7494 #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?}}
7495     for (int i = 0; i < 10; ++i)
7496       ;
7497   }
7498 #pragma omp target
7499 #pragma omp teams distribute parallel for
7500   for (int i = 0; i < 10; ++i) {
7501 #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?}}
7502     for (int i = 0; i < 10; ++i)
7503       ;
7504   }
7505 #pragma omp target
7506 #pragma omp teams distribute parallel for
7507   for (int i = 0; i < 10; ++i) {
7508 #pragma omp simd // OK
7509     for (int i = 0; i < 10; ++i)
7510       ;
7511   }
7512 #pragma omp target
7513 #pragma omp teams distribute parallel for
7514   for (int i = 0; i < 10; ++i) {
7515 #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?}}
7516     for (int i = 0; i < 10; ++i)
7517       ;
7518   }
7519 #pragma omp target
7520 #pragma omp teams distribute parallel for
7521   for (int i = 0; i < 10; ++i) {
7522 #pragma omp parallel // OK
7523     for (int i = 0; i < 10; ++i)
7524       ;
7525   }
7526 #pragma omp target
7527 #pragma omp teams distribute parallel for
7528   for (int i = 0; i < 10; ++i) {
7529 #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?}}
7530     {
7531       bar();
7532     }
7533   }
7534 #pragma omp target
7535 #pragma omp teams distribute parallel for
7536   for (int i = 0; i < 10; ++i) {
7537 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute parallel for region}}
7538     {
7539       bar();
7540     }
7541   }
7542 #pragma omp target
7543 #pragma omp teams distribute parallel for
7544   for (int i = 0; i < 10; ++i) {
7545 #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?}}
7546     {
7547       bar();
7548     }
7549   }
7550 #pragma omp target
7551 #pragma omp teams distribute parallel for
7552   for (int i = 0; i < 10; ++i) {
7553 #pragma omp master // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region}}
7554     {
7555       bar();
7556     }
7557   }
7558 #pragma omp target
7559 #pragma omp teams distribute parallel for
7560   for (int i = 0; i < 10; ++i) {
7561 #pragma omp critical // OK
7562     {
7563       bar();
7564     }
7565   }
7566 #pragma omp target
7567 #pragma omp teams distribute parallel for
7568   for (int i = 0; i < 10; ++i) {
7569 #pragma omp parallel // OK
7570     {
7571 #pragma omp single
7572       {
7573 	bar();
7574       }
7575     }
7576   }
7577 #pragma omp target
7578 #pragma omp teams distribute parallel for
7579   for (int i = 0; i < 10; ++i) {
7580 #pragma omp parallel for // OK
7581     for (int i = 0; i < 10; ++i)
7582       ;
7583   }
7584 #pragma omp target
7585 #pragma omp teams distribute parallel for
7586   for (int i = 0; i < 10; ++i) {
7587 #pragma omp parallel for simd // OK
7588     for (int i = 0; i < 10; ++i)
7589       ;
7590   }
7591 #pragma omp target
7592 #pragma omp teams distribute parallel for
7593   for (int i = 0; i < 10; ++i) {
7594 #pragma omp parallel sections // OK
7595     {
7596       bar();
7597     }
7598   }
7599 #pragma omp target
7600 #pragma omp teams distribute parallel for
7601   for (int i = 0; i < 10; ++i) {
7602 #pragma omp task // OK
7603     {
7604       bar();
7605     }
7606   }
7607 #pragma omp target
7608 #pragma omp teams distribute parallel for
7609   for (int i = 0; i < 10; ++i) {
7610 #pragma omp taskyield // OK
7611     bar();
7612   }
7613 #pragma omp target
7614 #pragma omp teams distribute parallel for
7615   for (int i = 0; i < 10; ++i) {
7616 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region}}
7617     bar();
7618   }
7619 #pragma omp target
7620 #pragma omp teams distribute parallel for
7621   for (int i = 0; i < 10; ++i) {
7622 #pragma omp taskwait // OK
7623     bar();
7624   }
7625 #pragma omp target
7626 #pragma omp teams distribute parallel for
7627   for (int i = 0; i < 10; ++i) {
7628 #pragma omp flush // OK
7629     bar();
7630   }
7631 #pragma omp target
7632 #pragma omp teams distribute parallel for
7633   for (int i = 0; i < 10; ++i) {
7634 #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?}}
7635     bar();
7636   }
7637 #pragma omp target
7638 #pragma omp teams distribute parallel for
7639   for (int i = 0; i < 10; ++i) {
7640 #pragma omp atomic // OK
7641     ++a;
7642   }
7643 #pragma omp target
7644 #pragma omp teams distribute parallel for
7645   for (int i = 0; i < 10; ++i) {
7646 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
7647     ++a;
7648   }
7649 #pragma omp target
7650 #pragma omp teams distribute parallel for
7651   for (int i = 0; i < 10; ++i) {
7652 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
7653     ++a;
7654   }
7655 #pragma omp target
7656 #pragma omp teams distribute parallel for
7657   for (int i = 0; i < 10; ++i) {
7658 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
7659     for (int i = 0; i < 10; ++i)
7660       ;
7661   }
7662 #pragma omp target
7663 #pragma omp teams distribute parallel for
7664   for (int i = 0; i < 10; ++i) {
7665 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
7666     ++a;
7667   }
7668 #pragma omp target
7669 #pragma omp teams distribute parallel for
7670   for (int i = 0; i < 10; ++i) {
7671 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
7672     ++a;
7673   }
7674 #pragma omp target
7675 #pragma omp teams distribute parallel for
7676   for (int i = 0; i < 10; ++i) {
7677 #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?}}
7678     ++a;
7679   }
7680 #pragma omp target
7681 #pragma omp teams distribute parallel for
7682   for (int i = 0; i < 10; ++i) {
7683 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
7684     ++a;
7685   }
7686 #pragma omp target
7687 #pragma omp teams distribute parallel for
7688   for (int i = 0; i < 10; ++i) {
7689 #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?}}
7690     for (int i = 0; i < 10; ++i)
7691       ++a;
7692   }
7693 #pragma omp target
7694 #pragma omp teams distribute parallel for
7695   for (int i = 0; i < 10; ++i) {
7696 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
7697     for (int i = 0; i < 10; ++i)
7698       ++a;
7699   }
7700 #pragma omp target
7701 #pragma omp teams distribute parallel for
7702   for (int i = 0; i < 10; ++i) {
7703 #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?}}
7704     for (int i = 0; i < 10; ++i)
7705       ++a;
7706   }
7707 #pragma omp target
7708 #pragma omp teams distribute parallel for
7709   for (int i = 0; i < 10; ++i) {
7710 #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?}}
7711     for (int i = 0; i < 10; ++i)
7712       ++a;
7713   }
7714 #pragma omp target
7715 #pragma omp teams distribute parallel for
7716   for (int i = 0; i < 10; ++i) {
7717 #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?}}
7718     for (int i = 0; i < 10; ++i)
7719       ++a;
7720   }
7721 #pragma omp target
7722 #pragma omp teams distribute parallel for
7723   for (int i = 0; i < 10; ++i) {
7724 #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?}}
7725     for (int i = 0; i < 10; ++i)
7726       ++a;
7727   }
7728 #pragma omp target
7729 #pragma omp teams distribute parallel for
7730   for (int i = 0; i < 10; ++i) {
7731 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
7732     ++a;
7733   }
7734 #pragma omp target
7735 #pragma omp teams distribute parallel for
7736   for (int i = 0; i < 10; ++i) {
7737 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
7738     for (int i = 0; i < 10; ++i)
7739       ++a;
7740   }
7741 #pragma omp target
7742 #pragma omp teams distribute parallel for
7743   for (int i = 0; i < 10; ++i) {
7744 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
7745     for (int i = 0; i < 10; ++i)
7746       ++a;
7747   }
7748 #pragma omp target
7749 #pragma omp teams distribute parallel for
7750   for (int i = 0; i < 10; ++i) {
7751 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
7752     for (int i = 0; i < 10; ++i)
7753       ++a;
7754   }
7755 #pragma omp target
7756 #pragma omp teams distribute parallel for
7757   for (int i = 0; i < 10; ++i) {
7758 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
7759     for (int i = 0; i < 10; ++i)
7760       ++a;
7761   }
7762 
7763 // TARGET TEAMS DIRECTIVE
7764 #pragma omp target teams
7765 #pragma omp parallel
7766   bar();
7767 #pragma omp target teams
7768 #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?}}
7769   for (int i = 0; i < 10; ++i)
7770     ;
7771 #pragma omp target teams
7772 #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?}}
7773   for (int i = 0; i < 10; ++i)
7774     ;
7775 #pragma omp target teams
7776 #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?}}
7777   for (int i = 0; i < 10; ++i)
7778     ;
7779 #pragma omp target teams
7780 #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?}}
7781   {
7782     bar();
7783   }
7784 #pragma omp target teams
7785 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams region}}
7786   {
7787     bar();
7788   }
7789 #pragma omp target teams
7790 #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?}}
7791   bar();
7792 
7793 #pragma omp target teams
7794 #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?}}
7795   {
7796     bar();
7797   }
7798 #pragma omp target teams
7799 #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?}}
7800   {
7801     bar();
7802   }
7803 #pragma omp target teams
7804 #pragma omp parallel for
7805   for (int i = 0; i < 10; ++i)
7806     ;
7807 #pragma omp target teams
7808 #pragma omp parallel for simd
7809   for (int i = 0; i < 10; ++i)
7810     ;
7811 #pragma omp target teams
7812 #pragma omp parallel sections
7813   {
7814     bar();
7815   }
7816 #pragma omp target teams
7817 #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?}}
7818   {
7819     bar();
7820   }
7821 #pragma omp target teams
7822   {
7823 #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?}}
7824     bar();
7825   }
7826 #pragma omp target teams
7827   {
7828 #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?}}
7829     bar();
7830   }
7831 #pragma omp target teams
7832   {
7833 #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?}}
7834     bar();
7835   }
7836 #pragma omp target teams
7837   {
7838 #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?}}
7839     bar();
7840   }
7841 #pragma omp target teams
7842   {
7843 #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?}}
7844     bar();
7845   }
7846 #pragma omp target teams
7847   {
7848 #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?}}
7849     ++a;
7850   }
7851 #pragma omp target teams
7852   {
7853 #pragma omp target // expected-error {{region cannot be nested inside 'target teams' region}}
7854     ++a;
7855   }
7856 #pragma omp target teams
7857   {
7858 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target teams' region}}
7859     ++a;
7860   }
7861 #pragma omp target teams
7862 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams' region}}
7863   for (int i = 0; i < 10; ++i)
7864     ;
7865 #pragma omp target teams
7866   {
7867 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams' region}}
7868   }
7869 #pragma omp target teams
7870   {
7871 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams' region}}
7872   }
7873 #pragma omp target teams
7874   {
7875 #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?}}
7876     ++a;
7877   }
7878 #pragma omp target teams
7879   {
7880 #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?}}
7881   for (int i = 0; i < 10; ++i)
7882     ++a;
7883   }
7884 #pragma omp target teams
7885 #pragma omp distribute
7886   for (int i = 0; i < 10; ++i)
7887     ;
7888 #pragma omp target teams
7889   {
7890 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams' region}}
7891     ++a;
7892   }
7893 #pragma omp target teams
7894 #pragma omp distribute parallel for
7895   for (int i = 0; i < 10; ++i)
7896     ;
7897 #pragma omp target teams
7898   {
7899 #pragma omp distribute parallel for
7900   for (int i = 0; i < 10; ++i)
7901     ;
7902 #pragma omp distribute parallel for
7903   for (int j = 0; j < 10; ++j)
7904     ;
7905   }
7906 #pragma omp target teams
7907   {
7908 #pragma omp distribute parallel for simd
7909   for (int i = 0; i < 10; ++i)
7910     ;
7911 #pragma omp distribute parallel for simd
7912   for (int j = 0; j < 10; ++j)
7913     ;
7914   }
7915 #pragma omp target teams
7916   {
7917 #pragma omp distribute simd
7918   for (int i = 0; i < 10; ++i)
7919     ;
7920 #pragma omp distribute simd
7921   for (int j = 0; j < 10; ++j)
7922     ;
7923   }
7924 #pragma omp target teams
7925   {
7926 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams' region}}
7927   for (int i = 0; i < 10; ++i)
7928     ;
7929   }
7930 #pragma omp target teams
7931   {
7932 #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?}}
7933   for (int i = 0; i < 10; ++i)
7934     ;
7935   }
7936 #pragma omp target teams
7937   {
7938 #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?}}
7939   for (int i = 0; i < 10; ++i)
7940     ;
7941   }
7942 #pragma omp target teams
7943   {
7944 #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?}}
7945   for (int i = 0; i < 10; ++i)
7946     ;
7947   }
7948 #pragma omp target teams
7949   {
7950 #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?}}
7951   for (int i = 0; i < 10; ++i)
7952     ;
7953   }
7954 #pragma omp target teams
7955   {
7956 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams' region}}
7957     a++;
7958   }
7959 #pragma omp target teams
7960   {
7961 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams' region}}
7962   for (int i = 0; i < 10; ++i)
7963     ;
7964   }
7965 #pragma omp target teams
7966   {
7967 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams' region}}
7968   for (int i = 0; i < 10; ++i)
7969     ;
7970   }
7971 #pragma omp target teams
7972   {
7973 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams' region}}
7974   for (int i = 0; i < 10; ++i)
7975     ;
7976   }
7977 #pragma omp target teams
7978   {
7979 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams' region}}
7980   for (int i = 0; i < 10; ++i)
7981     ;
7982   }
7983 
7984 // TARGET TEAMS DISTRIBUTE DIRECTIVE
7985 #pragma omp target teams distribute // OK
7986   for (int i = 0; i < 10; ++i)
7987     ;
7988 #pragma omp target teams distribute
7989   for (int i = 0; i < 10; ++i) {
7990 #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?}}
7991     for (int i = 0; i < 10; ++i)
7992       ;
7993   }
7994 #pragma omp target teams distribute
7995   for (int i = 0; i < 10; ++i) {
7996 #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?}}
7997     for (int i = 0; i < 10; ++i)
7998       ;
7999   }
8000 #pragma omp target teams distribute
8001   for (int i = 0; i < 10; ++i) {
8002 #pragma omp for // OK
8003     for (int i = 0; i < 10; ++i)
8004       ;
8005   }
8006 #pragma omp target teams distribute
8007   for (int i = 0; i < 10; ++i) {
8008 #pragma omp simd // OK
8009     for (int i = 0; i < 10; ++i)
8010       ;
8011   }
8012 #pragma omp target teams distribute
8013   for (int i = 0; i < 10; ++i) {
8014 #pragma omp for simd // OK
8015     for (int i = 0; i < 10; ++i)
8016       ;
8017   }
8018 #pragma omp target teams distribute
8019   for (int i = 0; i < 10; ++i) {
8020 #pragma omp parallel // OK
8021     for (int i = 0; i < 10; ++i)
8022       ;
8023   }
8024 #pragma omp target teams distribute
8025   for (int i = 0; i < 10; ++i) {
8026 #pragma omp sections // OK
8027     {
8028       bar();
8029     }
8030   }
8031 #pragma omp target teams distribute
8032   for (int i = 0; i < 10; ++i) {
8033 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams distribute region}}
8034     {
8035       bar();
8036     }
8037   }
8038 #pragma omp target teams distribute
8039   for (int i = 0; i < 10; ++i) {
8040 #pragma omp single // OK
8041     {
8042       bar();
8043     }
8044   }
8045 #pragma omp target teams distribute
8046   for (int i = 0; i < 10; ++i) {
8047 #pragma omp master // OK
8048     {
8049       bar();
8050     }
8051   }
8052 #pragma omp target teams distribute
8053   for (int i = 0; i < 10; ++i) {
8054 #pragma omp critical // OK
8055     {
8056       bar();
8057     }
8058   }
8059 #pragma omp target teams distribute
8060   for (int i = 0; i < 10; ++i) {
8061 #pragma omp parallel // OK
8062     {
8063 #pragma omp single
8064       {
8065 	bar();
8066       }
8067     }
8068   }
8069 #pragma omp target teams distribute
8070   for (int i = 0; i < 10; ++i) {
8071 #pragma omp parallel for // OK
8072     for (int i = 0; i < 10; ++i)
8073       ;
8074   }
8075 #pragma omp target teams distribute
8076   for (int i = 0; i < 10; ++i) {
8077 #pragma omp parallel for simd // OK
8078     for (int i = 0; i < 10; ++i)
8079       ;
8080   }
8081 #pragma omp target teams distribute
8082   for (int i = 0; i < 10; ++i) {
8083 #pragma omp parallel sections // OK
8084     {
8085       bar();
8086     }
8087   }
8088 #pragma omp target teams distribute
8089   for (int i = 0; i < 10; ++i) {
8090 #pragma omp task // OK
8091     {
8092       bar();
8093     }
8094   }
8095 #pragma omp target teams distribute
8096   for (int i = 0; i < 10; ++i) {
8097 #pragma omp taskyield // OK
8098     bar();
8099   }
8100 #pragma omp target teams distribute
8101   for (int i = 0; i < 10; ++i) {
8102 #pragma omp barrier // OK
8103     bar();
8104   }
8105 #pragma omp target teams distribute
8106   for (int i = 0; i < 10; ++i) {
8107 #pragma omp taskwait // OK
8108     bar();
8109   }
8110 #pragma omp target teams distribute
8111   for (int i = 0; i < 10; ++i) {
8112 #pragma omp flush // OK
8113     bar();
8114   }
8115 #pragma omp target teams distribute
8116   for (int i = 0; i < 10; ++i) {
8117 #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?}}
8118     bar();
8119   }
8120 #pragma omp target teams distribute
8121   for (int i = 0; i < 10; ++i) {
8122 #pragma omp atomic // OK
8123     ++a;
8124   }
8125 #pragma omp target teams distribute
8126   for (int i = 0; i < 10; ++i) {
8127 #pragma omp target // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8128     ++a;
8129   }
8130 #pragma omp target teams distribute
8131   for (int i = 0; i < 10; ++i) {
8132 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8133     ++a;
8134   }
8135 #pragma omp target teams distribute
8136   for (int i = 0; i < 10; ++i) {
8137 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8138     for (int i = 0; i < 10; ++i)
8139       ;
8140   }
8141 #pragma omp target teams distribute
8142   for (int i = 0; i < 10; ++i) {
8143 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8144     ++a;
8145   }
8146 #pragma omp target teams distribute
8147   for (int i = 0; i < 10; ++i) {
8148 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8149     ++a;
8150   }
8151 #pragma omp target teams distribute
8152   for (int i = 0; i < 10; ++i) {
8153 #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?}}
8154     ++a;
8155   }
8156 #pragma omp target teams distribute
8157   for (int i = 0; i < 10; ++i) {
8158 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8159     ++a;
8160   }
8161 #pragma omp target teams distribute
8162   for (int i = 0; i < 10; ++i) {
8163 #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?}}
8164     for (int i = 0; i < 10; ++i)
8165       ++a;
8166   }
8167 #pragma omp target teams distribute
8168   for (int i = 0; i < 10; ++i) {
8169 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8170     for (int i = 0; i < 10; ++i)
8171       ++a;
8172   }
8173 #pragma omp target teams distribute
8174   for (int i = 0; i < 10; ++i) {
8175 #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?}}
8176     for (int i = 0; i < 10; ++i)
8177       ++a;
8178   }
8179 #pragma omp target teams distribute
8180   for (int i = 0; i < 10; ++i) {
8181 #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?}}
8182     for (int i = 0; i < 10; ++i)
8183       ++a;
8184   }
8185 #pragma omp target teams distribute
8186   for (int i = 0; i < 10; ++i) {
8187 #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?}}
8188     for (int i = 0; i < 10; ++i)
8189       ++a;
8190   }
8191 #pragma omp target teams distribute
8192   for (int i = 0; i < 10; ++i) {
8193 #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?}}
8194     for (int i = 0; i < 10; ++i)
8195       ;
8196   }
8197 #pragma omp target teams distribute
8198   for (int i = 0; i < 10; ++i) {
8199 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8200     a++;
8201   }
8202 #pragma omp target teams distribute
8203   for (int i = 0; i < 10; ++i) {
8204 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8205     for (int i = 0; i < 10; ++i)
8206       ;
8207   }
8208 #pragma omp target teams distribute
8209   for (int i = 0; i < 10; ++i) {
8210 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8211     for (int i = 0; i < 10; ++i)
8212       ;
8213   }
8214 #pragma omp target teams distribute
8215   for (int i = 0; i < 10; ++i) {
8216 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8217     for (int i = 0; i < 10; ++i)
8218       ;
8219   }
8220 #pragma omp target teams distribute
8221   for (int i = 0; i < 10; ++i) {
8222 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
8223     for (int i = 0; i < 10; ++i)
8224       ;
8225   }
8226 
8227 // TARGET TEAMS DISTRIBUTE PARALLEL FOR DIRECTIVE
8228 #pragma omp target teams distribute parallel for // OK
8229   for (int i = 0; i < 10; ++i)
8230     ;
8231 #pragma omp target teams distribute parallel for
8232   for (int i = 0; i < 10; ++i) {
8233 #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?}}
8234     for (int i = 0; i < 10; ++i)
8235       ;
8236   }
8237 #pragma omp target teams distribute parallel for
8238   for (int i = 0; i < 10; ++i) {
8239 #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?}}
8240     for (int i = 0; i < 10; ++i)
8241       ;
8242   }
8243 #pragma omp target teams distribute parallel for
8244   for (int i = 0; i < 10; ++i) {
8245 #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?}}
8246     for (int i = 0; i < 10; ++i)
8247       ;
8248   }
8249 #pragma omp target teams distribute parallel for
8250   for (int i = 0; i < 10; ++i) {
8251 #pragma omp simd // OK
8252     for (int i = 0; i < 10; ++i)
8253       ;
8254   }
8255 #pragma omp target teams distribute parallel for
8256   for (int i = 0; i < 10; ++i) {
8257 #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?}}
8258     for (int i = 0; i < 10; ++i)
8259       ;
8260   }
8261 #pragma omp target teams distribute parallel for
8262   for (int i = 0; i < 10; ++i) {
8263 #pragma omp parallel // OK
8264     for (int i = 0; i < 10; ++i)
8265       ;
8266   }
8267 #pragma omp target teams distribute parallel for
8268   for (int i = 0; i < 10; ++i) {
8269 #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?}}
8270     {
8271       bar();
8272     }
8273   }
8274 #pragma omp target teams distribute parallel for
8275   for (int i = 0; i < 10; ++i) {
8276 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams distribute parallel for region}}
8277     {
8278       bar();
8279     }
8280   }
8281 #pragma omp target teams distribute parallel for
8282   for (int i = 0; i < 10; ++i) {
8283 #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?}}
8284     {
8285       bar();
8286     }
8287   }
8288 #pragma omp target teams distribute parallel for
8289   for (int i = 0; i < 10; ++i) {
8290 #pragma omp master // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
8291     {
8292       bar();
8293     }
8294   }
8295 #pragma omp target teams distribute parallel for
8296   for (int i = 0; i < 10; ++i) {
8297 #pragma omp critical // OK
8298     {
8299       bar();
8300     }
8301   }
8302 #pragma omp target teams distribute parallel for
8303   for (int i = 0; i < 10; ++i) {
8304 #pragma omp parallel // OK
8305     {
8306 #pragma omp single
8307       {
8308 	bar();
8309       }
8310     }
8311   }
8312 #pragma omp target teams distribute parallel for
8313   for (int i = 0; i < 10; ++i) {
8314 #pragma omp parallel for // OK
8315     for (int i = 0; i < 10; ++i)
8316       ;
8317   }
8318 #pragma omp target teams distribute parallel for
8319   for (int i = 0; i < 10; ++i) {
8320 #pragma omp parallel for simd // OK
8321     for (int i = 0; i < 10; ++i)
8322       ;
8323   }
8324 #pragma omp target teams distribute parallel for
8325   for (int i = 0; i < 10; ++i) {
8326 #pragma omp parallel sections // OK
8327     {
8328       bar();
8329     }
8330   }
8331 #pragma omp target teams distribute parallel for
8332   for (int i = 0; i < 10; ++i) {
8333 #pragma omp task // OK
8334     {
8335       bar();
8336     }
8337   }
8338 #pragma omp target teams distribute parallel for
8339   for (int i = 0; i < 10; ++i) {
8340 #pragma omp taskyield // OK
8341     bar();
8342   }
8343 #pragma omp target teams distribute parallel for
8344   for (int i = 0; i < 10; ++i) {
8345 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
8346     bar();
8347   }
8348 #pragma omp target teams distribute parallel for
8349   for (int i = 0; i < 10; ++i) {
8350 #pragma omp taskwait // OK
8351     bar();
8352   }
8353 #pragma omp target teams distribute parallel for
8354   for (int i = 0; i < 10; ++i) {
8355 #pragma omp flush // OK
8356     bar();
8357   }
8358 #pragma omp target teams distribute parallel for
8359   for (int i = 0; i < 10; ++i) {
8360 #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?}}
8361     bar();
8362   }
8363 #pragma omp target teams distribute parallel for
8364   for (int i = 0; i < 10; ++i) {
8365 #pragma omp atomic // OK
8366     ++a;
8367   }
8368 #pragma omp target teams distribute parallel for
8369   for (int i = 0; i < 10; ++i) {
8370 #pragma omp target // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8371     ++a;
8372   }
8373 #pragma omp target teams distribute parallel for
8374   for (int i = 0; i < 10; ++i) {
8375 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8376     ++a;
8377   }
8378 #pragma omp target teams distribute parallel for
8379   for (int i = 0; i < 10; ++i) {
8380 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8381     for (int i = 0; i < 10; ++i)
8382       ;
8383   }
8384 #pragma omp target teams distribute parallel for
8385   for (int i = 0; i < 10; ++i) {
8386 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8387     ++a;
8388   }
8389 #pragma omp target teams distribute parallel for
8390   for (int i = 0; i < 10; ++i) {
8391 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8392     ++a;
8393   }
8394 #pragma omp target teams distribute parallel for
8395   for (int i = 0; i < 10; ++i) {
8396 #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?}}
8397     ++a;
8398   }
8399 #pragma omp target teams distribute parallel for
8400   for (int i = 0; i < 10; ++i) {
8401 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8402     ++a;
8403   }
8404 #pragma omp target teams distribute parallel for
8405   for (int i = 0; i < 10; ++i) {
8406 #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?}}
8407     for (int i = 0; i < 10; ++i)
8408       ++a;
8409   }
8410 #pragma omp target teams distribute parallel for
8411   for (int i = 0; i < 10; ++i) {
8412 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8413     for (int i = 0; i < 10; ++i)
8414       ++a;
8415   }
8416 #pragma omp target teams distribute parallel for
8417   for (int i = 0; i < 10; ++i) {
8418 #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?}}
8419     for (int i = 0; i < 10; ++i)
8420       ++a;
8421   }
8422 #pragma omp target teams distribute parallel for
8423   for (int i = 0; i < 10; ++i) {
8424 #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?}}
8425     for (int i = 0; i < 10; ++i)
8426       ++a;
8427   }
8428 #pragma omp target teams distribute parallel for
8429   for (int i = 0; i < 10; ++i) {
8430 #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?}}
8431     for (int i = 0; i < 10; ++i)
8432       ++a;
8433   }
8434 #pragma omp target teams distribute parallel for
8435   for (int i = 0; i < 10; ++i) {
8436 #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?}}
8437     for (int i = 0; i < 10; ++i)
8438       ;
8439   }
8440 #pragma omp target teams distribute parallel for
8441   for (int i = 0; i < 10; ++i) {
8442 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8443     a++;
8444   }
8445 #pragma omp target teams distribute parallel for
8446   for (int i = 0; i < 10; ++i) {
8447 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8448     for (int i = 0; i < 10; ++i)
8449       ;
8450   }
8451 #pragma omp target teams distribute parallel for
8452   for (int i = 0; i < 10; ++i) {
8453 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8454     for (int i = 0; i < 10; ++i)
8455       ;
8456   }
8457 #pragma omp target teams distribute parallel for
8458   for (int i = 0; i < 10; ++i) {
8459 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8460     for (int i = 0; i < 10; ++i)
8461       ;
8462   }
8463 #pragma omp target teams distribute parallel for
8464   for (int i = 0; i < 10; ++i) {
8465 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
8466     for (int i = 0; i < 10; ++i)
8467       ;
8468   }
8469 
8470 // TARGET TEAMS DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
8471 #pragma omp target teams distribute parallel for simd // OK
8472   for (int i = 0; i < 10; ++i)
8473     ;
8474 #pragma omp target teams distribute parallel for simd
8475   for (int i = 0; i < 10; ++i) {
8476 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8477     for (int i = 0; i < 10; ++i)
8478       ;
8479   }
8480 #pragma omp target teams distribute parallel for simd
8481   for (int i = 0; i < 10; ++i) {
8482 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8483     for (int i = 0; i < 10; ++i)
8484       ;
8485   }
8486 #pragma omp target teams distribute parallel for simd
8487   for (int i = 0; i < 10; ++i) {
8488 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8489     for (int i = 0; i < 10; ++i)
8490       ;
8491   }
8492 #pragma omp target teams distribute parallel for simd
8493   for (int i = 0; i < 10; ++i) {
8494 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
8495     for (int i = 0; i < 10; ++i)
8496       ;
8497   }
8498 #pragma omp target teams distribute parallel for simd
8499   for (int i = 0; i < 10; ++i) {
8500 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8501     for (int i = 0; i < 10; ++i)
8502       ;
8503   }
8504 #pragma omp target teams distribute parallel for simd
8505   for (int i = 0; i < 10; ++i) {
8506 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8507     for (int i = 0; i < 10; ++i)
8508       ;
8509   }
8510 #pragma omp target teams distribute parallel for simd
8511   for (int i = 0; i < 10; ++i) {
8512 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8513     {
8514       bar();
8515     }
8516   }
8517 #pragma omp target teams distribute parallel for simd
8518   for (int i = 0; i < 10; ++i) {
8519 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8520     {
8521       bar();
8522     }
8523   }
8524 #pragma omp target teams distribute parallel for simd
8525   for (int i = 0; i < 10; ++i) {
8526 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8527     {
8528       bar();
8529     }
8530   }
8531 #pragma omp target teams distribute parallel for simd
8532   for (int i = 0; i < 10; ++i) {
8533 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8534     {
8535       bar();
8536     }
8537   }
8538 #pragma omp target teams distribute parallel for simd
8539   for (int i = 0; i < 10; ++i) {
8540 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8541     {
8542       bar();
8543     }
8544   }
8545 #pragma omp target teams distribute parallel for simd
8546   for (int i = 0; i < 10; ++i) {
8547 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8548     {
8549 #pragma omp single
8550       {
8551 	bar();
8552       }
8553     }
8554   }
8555 #pragma omp target teams distribute parallel for simd
8556   for (int i = 0; i < 10; ++i) {
8557 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8558     for (int i = 0; i < 10; ++i)
8559       ;
8560   }
8561 #pragma omp target teams distribute parallel for simd
8562   for (int i = 0; i < 10; ++i) {
8563 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8564     for (int i = 0; i < 10; ++i)
8565       ;
8566   }
8567 #pragma omp target teams distribute parallel for simd
8568   for (int i = 0; i < 10; ++i) {
8569 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8570     {
8571       bar();
8572     }
8573   }
8574 #pragma omp target teams distribute parallel for simd
8575   for (int i = 0; i < 10; ++i) {
8576 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8577     {
8578       bar();
8579     }
8580   }
8581 #pragma omp target teams distribute parallel for simd
8582   for (int i = 0; i < 10; ++i) {
8583 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8584     bar();
8585   }
8586 #pragma omp target teams distribute parallel for simd
8587   for (int i = 0; i < 10; ++i) {
8588 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8589     bar();
8590   }
8591 #pragma omp target teams distribute parallel for simd
8592   for (int i = 0; i < 10; ++i) {
8593 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8594     bar();
8595   }
8596 #pragma omp target teams distribute parallel for simd
8597   for (int i = 0; i < 10; ++i) {
8598 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8599     bar();
8600   }
8601 #pragma omp target teams distribute parallel for simd
8602   for (int i = 0; i < 10; ++i) {
8603 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8604     bar();
8605   }
8606 #pragma omp target teams distribute parallel for simd
8607   for (int i = 0; i < 10; ++i) {
8608 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}OK
8609     ++a;
8610   }
8611 #pragma omp target teams distribute parallel for simd
8612   for (int i = 0; i < 10; ++i) {
8613 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8614     ++a;
8615   }
8616 #pragma omp target teams distribute parallel for simd
8617   for (int i = 0; i < 10; ++i) {
8618 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8619     ++a;
8620   }
8621 #pragma omp target teams distribute parallel for simd
8622   for (int i = 0; i < 10; ++i) {
8623 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8624     for (int i = 0; i < 10; ++i)
8625       ;
8626   }
8627 #pragma omp target teams distribute parallel for simd
8628   for (int i = 0; i < 10; ++i) {
8629 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8630     ++a;
8631   }
8632 #pragma omp target teams distribute parallel for simd
8633   for (int i = 0; i < 10; ++i) {
8634 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8635     ++a;
8636   }
8637 #pragma omp target teams distribute parallel for simd
8638   for (int i = 0; i < 10; ++i) {
8639 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8640     ++a;
8641   }
8642 #pragma omp target teams distribute parallel for simd
8643   for (int i = 0; i < 10; ++i) {
8644 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8645     ++a;
8646   }
8647 #pragma omp target teams distribute parallel for simd
8648   for (int i = 0; i < 10; ++i) {
8649 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8650     for (int i = 0; i < 10; ++i)
8651       ++a;
8652   }
8653 #pragma omp target teams distribute parallel for simd
8654   for (int i = 0; i < 10; ++i) {
8655 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8656     for (int i = 0; i < 10; ++i)
8657       ++a;
8658   }
8659 #pragma omp target teams distribute parallel for simd
8660   for (int i = 0; i < 10; ++i) {
8661 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8662     for (int i = 0; i < 10; ++i)
8663       ++a;
8664   }
8665 #pragma omp target teams distribute parallel for simd
8666   for (int i = 0; i < 10; ++i) {
8667 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8668     for (int i = 0; i < 10; ++i)
8669       ++a;
8670   }
8671 #pragma omp target teams distribute parallel for simd
8672   for (int i = 0; i < 10; ++i) {
8673 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8674     for (int i = 0; i < 10; ++i)
8675       ++a;
8676   }
8677 #pragma omp target teams distribute parallel for simd
8678   for (int i = 0; i < 10; ++i) {
8679 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8680     for (int i = 0; i < 10; ++i)
8681       ;
8682   }
8683 #pragma omp target teams distribute parallel for simd
8684   for (int i = 0; i < 10; ++i) {
8685 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8686     a++;
8687   }
8688 #pragma omp target teams distribute parallel for simd
8689   for (int i = 0; i < 10; ++i) {
8690 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8691     for (int i = 0; i < 10; ++i)
8692       ;
8693   }
8694 #pragma omp target teams distribute parallel for simd
8695   for (int i = 0; i < 10; ++i) {
8696 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8697     for (int i = 0; i < 10; ++i)
8698       ;
8699   }
8700 #pragma omp target teams distribute parallel for simd
8701   for (int i = 0; i < 10; ++i) {
8702 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8703     for (int i = 0; i < 10; ++i)
8704       ;
8705   }
8706 #pragma omp target teams distribute parallel for simd
8707   for (int i = 0; i < 10; ++i) {
8708 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8709     for (int i = 0; i < 10; ++i)
8710       ;
8711   }
8712 
8713 // TARGET TEAMS DISTRIBUTE SIMD DIRECTIVE
8714 #pragma omp target teams distribute simd // OK
8715   for (int i = 0; i < 10; ++i)
8716     ;
8717 #pragma omp target teams distribute simd
8718   for (int i = 0; i < 10; ++i) {
8719 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8720     for (int i = 0; i < 10; ++i)
8721       ;
8722   }
8723 #pragma omp target teams distribute simd
8724   for (int i = 0; i < 10; ++i) {
8725 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8726     for (int i = 0; i < 10; ++i)
8727       ;
8728   }
8729 #pragma omp target teams distribute simd
8730   for (int i = 0; i < 10; ++i) {
8731 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8732     for (int i = 0; i < 10; ++i)
8733       ;
8734   }
8735 #pragma omp target teams distribute simd
8736   for (int i = 0; i < 10; ++i) {
8737 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
8738     for (int i = 0; i < 10; ++i)
8739       ;
8740   }
8741 #pragma omp target teams distribute simd
8742   for (int i = 0; i < 10; ++i) {
8743 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8744     for (int i = 0; i < 10; ++i)
8745       ;
8746   }
8747 #pragma omp target teams distribute simd
8748   for (int i = 0; i < 10; ++i) {
8749 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8750     for (int i = 0; i < 10; ++i)
8751       ;
8752   }
8753 #pragma omp target teams distribute simd
8754   for (int i = 0; i < 10; ++i) {
8755 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8756     {
8757       bar();
8758     }
8759   }
8760 #pragma omp target teams distribute simd
8761   for (int i = 0; i < 10; ++i) {
8762 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8763     {
8764       bar();
8765     }
8766   }
8767 #pragma omp target teams distribute simd
8768   for (int i = 0; i < 10; ++i) {
8769 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8770     {
8771       bar();
8772     }
8773   }
8774 #pragma omp target teams distribute simd
8775   for (int i = 0; i < 10; ++i) {
8776 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8777     {
8778       bar();
8779     }
8780   }
8781 #pragma omp target teams distribute simd
8782   for (int i = 0; i < 10; ++i) {
8783 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8784     {
8785       bar();
8786     }
8787   }
8788 #pragma omp target teams distribute simd
8789   for (int i = 0; i < 10; ++i) {
8790 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8791     {
8792 #pragma omp single
8793       {
8794 	bar();
8795       }
8796     }
8797   }
8798 #pragma omp target teams distribute simd
8799   for (int i = 0; i < 10; ++i) {
8800 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8801     for (int i = 0; i < 10; ++i)
8802       ;
8803   }
8804 #pragma omp target teams distribute simd
8805   for (int i = 0; i < 10; ++i) {
8806 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8807     for (int i = 0; i < 10; ++i)
8808       ;
8809   }
8810 #pragma omp target teams distribute simd
8811   for (int i = 0; i < 10; ++i) {
8812 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8813     {
8814       bar();
8815     }
8816   }
8817 #pragma omp target teams distribute simd
8818   for (int i = 0; i < 10; ++i) {
8819 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8820     {
8821       bar();
8822     }
8823   }
8824 #pragma omp target teams distribute simd
8825   for (int i = 0; i < 10; ++i) {
8826 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8827     bar();
8828   }
8829 #pragma omp target teams distribute simd
8830   for (int i = 0; i < 10; ++i) {
8831 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8832     bar();
8833   }
8834 #pragma omp target teams distribute simd
8835   for (int i = 0; i < 10; ++i) {
8836 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8837     bar();
8838   }
8839 #pragma omp target teams distribute simd
8840   for (int i = 0; i < 10; ++i) {
8841 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8842     bar();
8843   }
8844 #pragma omp target teams distribute simd
8845   for (int i = 0; i < 10; ++i) {
8846 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8847     bar();
8848   }
8849 #pragma omp target teams distribute simd
8850   for (int i = 0; i < 10; ++i) {
8851 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}OK
8852     ++a;
8853   }
8854 #pragma omp target teams distribute simd
8855   for (int i = 0; i < 10; ++i) {
8856 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8857     ++a;
8858   }
8859 #pragma omp target teams distribute simd
8860   for (int i = 0; i < 10; ++i) {
8861 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8862     ++a;
8863   }
8864 #pragma omp target teams distribute simd
8865   for (int i = 0; i < 10; ++i) {
8866 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8867     for (int i = 0; i < 10; ++i)
8868       ;
8869   }
8870 #pragma omp target teams distribute simd
8871   for (int i = 0; i < 10; ++i) {
8872 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8873     ++a;
8874   }
8875 #pragma omp target teams distribute simd
8876   for (int i = 0; i < 10; ++i) {
8877 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8878     ++a;
8879   }
8880 #pragma omp target teams distribute simd
8881   for (int i = 0; i < 10; ++i) {
8882 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8883     ++a;
8884   }
8885 #pragma omp target teams distribute simd
8886   for (int i = 0; i < 10; ++i) {
8887 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8888     ++a;
8889   }
8890 #pragma omp target teams distribute simd
8891   for (int i = 0; i < 10; ++i) {
8892 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8893     for (int i = 0; i < 10; ++i)
8894       ++a;
8895   }
8896 #pragma omp target teams distribute simd
8897   for (int i = 0; i < 10; ++i) {
8898 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8899     for (int i = 0; i < 10; ++i)
8900       ++a;
8901   }
8902 #pragma omp target teams distribute simd
8903   for (int i = 0; i < 10; ++i) {
8904 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8905     for (int i = 0; i < 10; ++i)
8906       ++a;
8907   }
8908 #pragma omp target teams distribute simd
8909   for (int i = 0; i < 10; ++i) {
8910 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8911     for (int i = 0; i < 10; ++i)
8912       ++a;
8913   }
8914 #pragma omp target teams distribute simd
8915   for (int i = 0; i < 10; ++i) {
8916 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8917     for (int i = 0; i < 10; ++i)
8918       ++a;
8919   }
8920 #pragma omp target teams distribute simd
8921   for (int i = 0; i < 10; ++i) {
8922 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8923     for (int i = 0; i < 10; ++i)
8924       ;
8925   }
8926 #pragma omp target teams distribute simd
8927   for (int i = 0; i < 10; ++i) {
8928 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8929     a++;
8930   }
8931 #pragma omp target teams distribute simd
8932   for (int i = 0; i < 10; ++i) {
8933 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8934     for (int i = 0; i < 10; ++i)
8935       ;
8936   }
8937 #pragma omp target teams distribute simd
8938   for (int i = 0; i < 10; ++i) {
8939 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8940     for (int i = 0; i < 10; ++i)
8941       ;
8942   }
8943 #pragma omp target teams distribute simd
8944   for (int i = 0; i < 10; ++i) {
8945 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8946     for (int i = 0; i < 10; ++i)
8947       ;
8948   }
8949 #pragma omp target teams distribute simd
8950   for (int i = 0; i < 10; ++i) {
8951 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
8952     for (int i = 0; i < 10; ++i)
8953       ;
8954   }
8955 
8956 }
8957 
foo()8958 void foo() {
8959   int a = 0;
8960 // PARALLEL DIRECTIVE
8961 #pragma omp parallel
8962 #pragma omp for
8963   for (int i = 0; i < 10; ++i)
8964     ;
8965 #pragma omp parallel
8966 #pragma omp simd
8967   for (int i = 0; i < 10; ++i)
8968     ;
8969 #pragma omp parallel
8970 #pragma omp for simd
8971   for (int i = 0; i < 10; ++i)
8972     ;
8973 #pragma omp parallel
8974 #pragma omp sections
8975   {
8976     bar();
8977   }
8978 #pragma omp parallel
8979 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel region}}
8980   {
8981     bar();
8982   }
8983 #pragma omp parallel
8984 #pragma omp sections
8985   {
8986     bar();
8987   }
8988 #pragma omp parallel
8989 #pragma omp single
8990   bar();
8991 #pragma omp parallel
8992 #pragma omp master
8993   bar();
8994 #pragma omp parallel
8995 #pragma omp critical
8996   bar();
8997 #pragma omp parallel
8998 #pragma omp parallel for
8999   for (int i = 0; i < 10; ++i)
9000     ;
9001 #pragma omp parallel
9002 #pragma omp parallel for simd
9003   for (int i = 0; i < 10; ++i)
9004     ;
9005 #pragma omp parallel
9006 #pragma omp parallel sections
9007   {
9008     bar();
9009   }
9010 #pragma omp parallel
9011 #pragma omp task
9012   {
9013     bar();
9014   }
9015 #pragma omp parallel
9016   {
9017 #pragma omp taskyield
9018     bar();
9019   }
9020 #pragma omp parallel
9021   {
9022 #pragma omp barrier
9023     bar();
9024   }
9025 #pragma omp parallel
9026   {
9027 #pragma omp taskwait
9028     bar();
9029   }
9030 #pragma omp parallel
9031   {
9032 #pragma omp flush
9033     bar();
9034   }
9035 #pragma omp parallel
9036   {
9037 #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?}}
9038     bar();
9039   }
9040 #pragma omp parallel
9041   {
9042 #pragma omp atomic
9043     ++a;
9044   }
9045 #pragma omp parallel
9046   {
9047 #pragma omp target
9048     ++a;
9049   }
9050 #pragma omp parallel
9051   {
9052 #pragma omp target parallel
9053     ++a;
9054   }
9055 #pragma omp parallel
9056 #pragma omp target parallel for
9057   for (int i = 0; i < 10; ++i)
9058     ;
9059 #pragma omp parallel
9060   {
9061 #pragma omp target enter data map(to: a)
9062     ++a;
9063   }
9064 #pragma omp parallel
9065   {
9066 #pragma omp target exit data map(from: a)
9067     ++a;
9068   }
9069 #pragma omp parallel
9070   {
9071 #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?}}
9072     ++a;
9073   }
9074 #pragma omp parallel
9075   {
9076 #pragma omp taskloop
9077   for (int i = 0; i < 10; ++i)
9078     ++a;
9079   }
9080 #pragma omp parallel
9081   {
9082 #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?}}
9083     for (int i = 0; i < 10; ++i)
9084       ;
9085   }
9086 #pragma omp parallel
9087   {
9088 #pragma omp target update to(a)
9089     a++;
9090   }
9091 #pragma omp parallel
9092   {
9093 #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?}}
9094     for (int i = 0; i < 10; ++i)
9095       ;
9096   }
9097 #pragma omp parallel
9098   {
9099 #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?}}
9100     for (int i = 0; i < 10; ++i)
9101       ;
9102   }
9103 #pragma omp parallel
9104   {
9105 #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?}}
9106     for (int i = 0; i < 10; ++i)
9107       ;
9108   }
9109 #pragma omp parallel
9110   {
9111 #pragma omp target simd // OK
9112     for (int i = 0; i < 10; ++i)
9113       ;
9114   }
9115 #pragma omp parallel
9116   {
9117 #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?}}
9118     for (int i = 0; i < 10; ++i)
9119       ;
9120   }
9121 #pragma omp parallel
9122   {
9123 #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?}}
9124     for (int i = 0; i < 10; ++i)
9125       ;
9126   }
9127 #pragma omp parallel
9128   {
9129 #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?}}
9130     for (int i = 0; i < 10; ++i)
9131       ;
9132   }
9133 #pragma omp parallel
9134   {
9135 #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?}}
9136     for (int i = 0; i < 10; ++i)
9137       ;
9138   }
9139 #pragma omp parallel
9140   {
9141 #pragma omp target teams // OK
9142     a++;
9143   }
9144 #pragma omp parallel
9145   {
9146 #pragma omp target teams distribute // OK
9147     for (int i = 0; i < 10; ++i)
9148       ;
9149   }
9150 #pragma omp parallel
9151   {
9152 #pragma omp target teams distribute parallel for // OK
9153     for (int i = 0; i < 10; ++i)
9154       ;
9155   }
9156 #pragma omp parallel
9157   {
9158 #pragma omp target teams distribute parallel for simd // OK
9159     for (int i = 0; i < 10; ++i)
9160       ;
9161   }
9162 #pragma omp parallel
9163   {
9164 #pragma omp target teams distribute simd // OK
9165     for (int i = 0; i < 10; ++i)
9166       ;
9167   }
9168 
9169 // SIMD DIRECTIVE
9170 #pragma omp simd
9171   for (int i = 0; i < 10; ++i) {
9172 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9173     for (int i = 0; i < 10; ++i)
9174       ;
9175   }
9176 #pragma omp simd
9177   for (int i = 0; i < 10; ++i) {
9178 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
9179     for (int i = 0; i < 10; ++i)
9180       ;
9181   }
9182 #pragma omp simd
9183   for (int i = 0; i < 10; ++i) {
9184 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9185     for (int i = 0; i < 10; ++i)
9186       ;
9187   }
9188 #pragma omp simd
9189   for (int i = 0; i < 10; ++i) {
9190 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9191     for (int i = 0; i < 10; ++i)
9192       ;
9193   }
9194 #pragma omp simd
9195   for (int i = 0; i < 10; ++i) {
9196 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9197     {
9198       bar();
9199     }
9200   }
9201 #pragma omp simd
9202   for (int i = 0; i < 10; ++i) {
9203 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9204     {
9205       bar();
9206     }
9207   }
9208 #pragma omp simd
9209   for (int i = 0; i < 10; ++i) {
9210 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9211     bar();
9212 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9213     bar();
9214   }
9215 #pragma omp simd
9216   for (int i = 0; i < 10; ++i) {
9217 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9218     bar();
9219 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9220     bar();
9221   }
9222 #pragma omp simd
9223   for (int i = 0; i < 10; ++i) {
9224 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9225     for (int i = 0; i < 10; ++i)
9226       ;
9227   }
9228 #pragma omp simd
9229   for (int i = 0; i < 10; ++i) {
9230 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9231     for (int i = 0; i < 10; ++i)
9232       ;
9233   }
9234 #pragma omp simd
9235   for (int i = 0; i < 10; ++i) {
9236 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9237     {
9238       bar();
9239     }
9240   }
9241 #pragma omp simd
9242   for (int i = 0; i < 10; ++i) {
9243 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9244     {
9245       bar();
9246     }
9247   }
9248 #pragma omp simd
9249   for (int i = 0; i < 10; ++i) {
9250 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9251     bar();
9252   }
9253 #pragma omp simd
9254   for (int i = 0; i < 10; ++i) {
9255 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9256     bar();
9257   }
9258 #pragma omp simd
9259   for (int i = 0; i < 10; ++i) {
9260 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9261     bar();
9262   }
9263 #pragma omp simd
9264   for (int i = 0; i < 10; ++i) {
9265 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9266     bar();
9267   }
9268 #pragma omp simd
9269   for (int i = 0; i < 10; ++i) {
9270 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9271     bar();
9272   }
9273 #pragma omp simd
9274   for (int i = 0; i < 10; ++i) {
9275 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9276     ++a;
9277   }
9278 #pragma omp simd
9279   for (int i = 0; i < 10; ++i) {
9280 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9281     ++a;
9282   }
9283 #pragma omp simd
9284   for (int i = 0; i < 10; ++i) {
9285 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9286     ++a;
9287   }
9288 #pragma omp simd
9289   for (int i = 0; i < 10; ++i) {
9290 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9291     for (int i = 0; i < 10; ++i)
9292       ;
9293   }
9294 #pragma omp simd
9295   for (int i = 0; i < 10; ++i) {
9296 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9297     ++a;
9298   }
9299 #pragma omp simd
9300   for (int i = 0; i < 10; ++i) {
9301 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9302     ++a;
9303   }
9304 #pragma omp simd
9305   for (int i = 0; i < 10; ++i) {
9306 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9307     ++a;
9308   }
9309 #pragma omp simd
9310   for (int i = 0; i < 10; ++i) {
9311 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9312   for (int i = 0; i < 10; ++i)
9313     ++a;
9314   }
9315 #pragma omp simd
9316   for (int i = 0; i < 10; ++i) {
9317 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9318     for (int j = 0; j < 10; ++j)
9319       ;
9320   }
9321 #pragma omp simd
9322   for (int i = 0; i < 10; ++i) {
9323 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9324     a++;
9325   }
9326 #pragma omp simd
9327   for (int i = 0; i < 10; ++i) {
9328 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9329     for (int j = 0; j < 10; ++j)
9330       ;
9331   }
9332 #pragma omp simd
9333   for (int i = 0; i < 10; ++i) {
9334 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9335     for (int j = 0; j < 10; ++j)
9336       ;
9337   }
9338 #pragma omp simd
9339   for (int i = 0; i < 10; ++i) {
9340 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9341     for (int j = 0; j < 10; ++j)
9342       ;
9343   }
9344 #pragma omp simd
9345   for (int i = 0; i < 10; ++i) {
9346 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9347     for (int j = 0; j < 10; ++j)
9348       ;
9349   }
9350 #pragma omp simd
9351   for (int i = 0; i < 10; ++i) {
9352 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9353     for (int j = 0; j < 10; ++j)
9354       ;
9355   }
9356 #pragma omp simd
9357   for (int i = 0; i < 10; ++i) {
9358 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9359     for (int j = 0; j < 10; ++j)
9360       ;
9361   }
9362 #pragma omp simd
9363   for (int i = 0; i < 10; ++i) {
9364 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9365     for (int j = 0; j < 10; ++j)
9366       ;
9367   }
9368 #pragma omp simd
9369   for (int i = 0; i < 10; ++i) {
9370 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9371     for (int j = 0; j < 10; ++j)
9372       ;
9373   }
9374 #pragma omp simd
9375   for (int i = 0; i < 10; ++i) {
9376 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9377     a++;
9378   }
9379 #pragma omp simd
9380   for (int i = 0; i < 10; ++i) {
9381 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9382     for (int j = 0; j < 10; ++j)
9383       ;
9384   }
9385 #pragma omp simd
9386   for (int i = 0; i < 10; ++i) {
9387 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9388     for (int j = 0; j < 10; ++j)
9389       ;
9390   }
9391 #pragma omp simd
9392   for (int i = 0; i < 10; ++i) {
9393 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9394     for (int j = 0; j < 10; ++j)
9395       ;
9396   }
9397 #pragma omp simd
9398   for (int i = 0; i < 10; ++i) {
9399 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9400     for (int j = 0; j < 10; ++j)
9401       ;
9402   }
9403 
9404 // FOR DIRECTIVE
9405 #pragma omp for
9406   for (int i = 0; i < 10; ++i) {
9407 #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?}}
9408     for (int i = 0; i < 10; ++i)
9409       ;
9410   }
9411 #pragma omp for
9412   for (int i = 0; i < 10; ++i) {
9413 #pragma omp simd
9414     for (int i = 0; i < 10; ++i)
9415       ;
9416   }
9417 #pragma omp for
9418   for (int i = 0; i < 10; ++i) {
9419 #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?}}
9420     for (int i = 0; i < 10; ++i)
9421       ;
9422   }
9423 #pragma omp for
9424   for (int i = 0; i < 10; ++i) {
9425 #pragma omp parallel
9426     for (int i = 0; i < 10; ++i)
9427       ;
9428   }
9429 #pragma omp for
9430   for (int i = 0; i < 10; ++i) {
9431 #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?}}
9432     {
9433       bar();
9434     }
9435   }
9436 #pragma omp for
9437   for (int i = 0; i < 10; ++i) {
9438 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a for region}}
9439     {
9440       bar();
9441     }
9442   }
9443 #pragma omp for
9444   for (int i = 0; i < 10; ++i) {
9445 #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?}}
9446     bar();
9447 #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
9448     bar();
9449 #pragma omp critical
9450     bar();
9451   }
9452 #pragma omp for
9453   for (int i = 0; i < 10; ++i) {
9454 #pragma omp parallel
9455     {
9456 #pragma omp single // OK
9457       {
9458         bar();
9459       }
9460 #pragma omp for // OK
9461       for (int i = 0; i < 10; ++i)
9462         ;
9463 #pragma omp for simd // OK
9464       for (int i = 0; i < 10; ++i)
9465         ;
9466 #pragma omp sections // OK
9467       {
9468         bar();
9469       }
9470     }
9471   }
9472 #pragma omp for
9473   for (int i = 0; i < 10; ++i) {
9474 #pragma omp parallel for
9475     for (int i = 0; i < 10; ++i)
9476       ;
9477   }
9478 #pragma omp for
9479   for (int i = 0; i < 10; ++i) {
9480 #pragma omp parallel for simd
9481     for (int i = 0; i < 10; ++i)
9482       ;
9483   }
9484 #pragma omp for
9485   for (int i = 0; i < 10; ++i) {
9486 #pragma omp parallel sections
9487     {
9488       bar();
9489     }
9490   }
9491 #pragma omp for
9492   for (int i = 0; i < 10; ++i) {
9493 #pragma omp task
9494     {
9495       bar();
9496     }
9497   }
9498 #pragma omp for
9499   for (int i = 0; i < 10; ++i) {
9500 #pragma omp taskyield
9501     bar();
9502   }
9503 #pragma omp for
9504   for (int i = 0; i < 10; ++i) {
9505 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}}
9506     bar();
9507   }
9508 #pragma omp for
9509   for (int i = 0; i < 10; ++i) {
9510 #pragma omp taskwait
9511     bar();
9512   }
9513 #pragma omp for
9514   for (int i = 0; i < 10; ++i) {
9515 #pragma omp flush
9516     bar();
9517   }
9518 #pragma omp for
9519   for (int i = 0; i < 10; ++i) {
9520 #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?}}
9521     bar();
9522   }
9523 #pragma omp for ordered
9524   for (int i = 0; i < 10; ++i) {
9525 #pragma omp ordered // OK
9526     bar();
9527   }
9528 #pragma omp for
9529   for (int i = 0; i < 10; ++i) {
9530 #pragma omp atomic
9531     ++a;
9532   }
9533 #pragma omp for
9534   for (int i = 0; i < 10; ++i) {
9535 #pragma omp target
9536     ++a;
9537   }
9538 #pragma omp for
9539   for (int i = 0; i < 10; ++i) {
9540 #pragma omp target parallel
9541     ++a;
9542   }
9543 #pragma omp for
9544   for (int i = 0; i < 10; ++i) {
9545 #pragma omp target parallel for
9546     for (int i = 0; i < 10; ++i)
9547       ;
9548   }
9549 #pragma omp for
9550   for (int i = 0; i < 10; ++i) {
9551 #pragma omp target enter data map(to: a)
9552     ++a;
9553   }
9554 #pragma omp for
9555   for (int i = 0; i < 10; ++i) {
9556 #pragma omp target exit data map(from: a)
9557     ++a;
9558   }
9559 #pragma omp for
9560   for (int i = 0; i < 10; ++i) {
9561 #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?}}
9562     ++a;
9563   }
9564 #pragma omp for
9565   for (int i = 0; i < 10; ++i) {
9566 #pragma omp taskloop
9567   for (int i = 0; i < 10; ++i)
9568     ++a;
9569   }
9570 #pragma omp for
9571   for (int i = 0; i < 10; ++i) {
9572 #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?}}
9573     for (int j = 0; j < 10; ++j)
9574       ;
9575   }
9576 #pragma omp for
9577   for (int i = 0; i < 10; ++i) {
9578 #pragma omp target update to(a)
9579     ++a;
9580   }
9581 #pragma omp for
9582   for (int i = 0; i < 10; ++i) {
9583 #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?}}
9584     for (int j = 0; j < 10; ++j)
9585       ;
9586   }
9587 #pragma omp for
9588   for (int i = 0; i < 10; ++i) {
9589 #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?}}
9590     for (int j = 0; j < 10; ++j)
9591       ;
9592   }
9593 #pragma omp for
9594   for (int i = 0; i < 10; ++i) {
9595 #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?}}
9596     for (int j = 0; j < 10; ++j)
9597       ;
9598   }
9599 #pragma omp for
9600   for (int i = 0; i < 10; ++i) {
9601 #pragma omp target simd // OK
9602     for (int j = 0; j < 10; ++j)
9603       ;
9604   }
9605 #pragma omp for
9606   for (int i = 0; i < 10; ++i) {
9607 #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?}}
9608     for (int j = 0; j < 10; ++j)
9609       ;
9610   }
9611 #pragma omp for
9612   for (int i = 0; i < 10; ++i) {
9613 #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?}}
9614     for (int j = 0; j < 10; ++j)
9615       ;
9616   }
9617 #pragma omp for
9618   for (int i = 0; i < 10; ++i) {
9619 #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?}}
9620     for (int j = 0; j < 10; ++j)
9621       ;
9622   }
9623 #pragma omp for
9624   for (int i = 0; i < 10; ++i) {
9625 #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?}}
9626     for (int j = 0; j < 10; ++j)
9627       ;
9628   }
9629 #pragma omp for
9630   for (int i = 0; i < 10; ++i) {
9631 #pragma omp target teams // OK
9632     a++;
9633   }
9634 #pragma omp for
9635   for (int i = 0; i < 10; ++i) {
9636 #pragma omp target teams distribute // OK
9637     for (int j = 0; j < 10; ++j)
9638       ;
9639   }
9640 #pragma omp for
9641   for (int i = 0; i < 10; ++i) {
9642 #pragma omp target teams distribute parallel for // OK
9643     for (int j = 0; j < 10; ++j)
9644       ;
9645   }
9646 #pragma omp for
9647   for (int i = 0; i < 10; ++i) {
9648 #pragma omp target teams distribute parallel for simd // OK
9649     for (int j = 0; j < 10; ++j)
9650       ;
9651   }
9652 #pragma omp for
9653   for (int i = 0; i < 10; ++i) {
9654 #pragma omp target teams distribute simd // OK
9655     for (int j = 0; j < 10; ++j)
9656       ;
9657   }
9658 
9659 // FOR SIMD DIRECTIVE
9660 #pragma omp for simd
9661   for (int i = 0; i < 10; ++i) {
9662 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9663     for (int i = 0; i < 10; ++i)
9664       ;
9665   }
9666 #pragma omp for simd
9667   for (int i = 0; i < 10; ++i) {
9668 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
9669     for (int i = 0; i < 10; ++i)
9670       ;
9671   }
9672 #pragma omp for simd
9673   for (int i = 0; i < 10; ++i) {
9674 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9675     for (int i = 0; i < 10; ++i)
9676       ;
9677   }
9678 #pragma omp for simd
9679   for (int i = 0; i < 10; ++i) {
9680 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9681     for (int i = 0; i < 10; ++i)
9682       ;
9683   }
9684 #pragma omp for simd
9685   for (int i = 0; i < 10; ++i) {
9686 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9687     {
9688       bar();
9689     }
9690   }
9691 #pragma omp for simd
9692   for (int i = 0; i < 10; ++i) {
9693 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9694     {
9695       bar();
9696     }
9697   }
9698 #pragma omp for simd
9699   for (int i = 0; i < 10; ++i) {
9700 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9701     bar();
9702 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9703     bar();
9704   }
9705 #pragma omp for simd
9706   for (int i = 0; i < 10; ++i) {
9707 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9708     bar();
9709 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9710     bar();
9711   }
9712 #pragma omp for simd
9713   for (int i = 0; i < 10; ++i) {
9714 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9715     for (int i = 0; i < 10; ++i)
9716       ;
9717   }
9718 #pragma omp for simd
9719   for (int i = 0; i < 10; ++i) {
9720 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9721     for (int i = 0; i < 10; ++i)
9722       ;
9723   }
9724 #pragma omp for simd
9725   for (int i = 0; i < 10; ++i) {
9726 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9727     {
9728       bar();
9729     }
9730   }
9731 #pragma omp for simd
9732   for (int i = 0; i < 10; ++i) {
9733 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9734     {
9735       bar();
9736     }
9737   }
9738 #pragma omp for simd
9739   for (int i = 0; i < 10; ++i) {
9740 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9741     bar();
9742   }
9743 #pragma omp for simd
9744   for (int i = 0; i < 10; ++i) {
9745 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9746     bar();
9747   }
9748 #pragma omp for simd
9749   for (int i = 0; i < 10; ++i) {
9750 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9751     bar();
9752   }
9753 #pragma omp for simd
9754   for (int i = 0; i < 10; ++i) {
9755 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9756     bar();
9757   }
9758 #pragma omp for simd
9759   for (int i = 0; i < 10; ++i) {
9760 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9761     bar();
9762   }
9763 #pragma omp for simd
9764   for (int i = 0; i < 10; ++i) {
9765 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9766     ++a;
9767   }
9768 #pragma omp for simd
9769   for (int i = 0; i < 10; ++i) {
9770 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9771     ++a;
9772   }
9773 #pragma omp for simd
9774   for (int i = 0; i < 10; ++i) {
9775 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9776     ++a;
9777   }
9778 #pragma omp for simd
9779   for (int i = 0; i < 10; ++i) {
9780 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9781     for (int i = 0; i < 10; ++i)
9782       ;
9783   }
9784 #pragma omp for simd
9785   for (int i = 0; i < 10; ++i) {
9786 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9787     ++a;
9788   }
9789 #pragma omp for simd
9790   for (int i = 0; i < 10; ++i) {
9791 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9792     ++a;
9793   }
9794 #pragma omp for simd
9795   for (int i = 0; i < 10; ++i) {
9796 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9797     ++a;
9798   }
9799 #pragma omp for simd
9800   for (int i = 0; i < 10; ++i) {
9801 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9802   for (int i = 0; i < 10; ++i)
9803     ++a;
9804   }
9805 #pragma omp for simd
9806   for (int i = 0; i < 10; ++i) {
9807 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9808     for (int j = 0; j < 10; ++j)
9809       ;
9810   }
9811 #pragma omp for simd
9812   for (int i = 0; i < 10; ++i) {
9813 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9814     ++a;
9815   }
9816 #pragma omp for simd
9817   for (int i = 0; i < 10; ++i) {
9818 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9819     for (int j = 0; j < 10; ++j)
9820       ;
9821   }
9822 #pragma omp for simd
9823   for (int i = 0; i < 10; ++i) {
9824 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9825     for (int j = 0; j < 10; ++j)
9826       ;
9827   }
9828 #pragma omp for simd
9829   for (int i = 0; i < 10; ++i) {
9830 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9831     for (int j = 0; j < 10; ++j)
9832       ;
9833   }
9834 #pragma omp for simd
9835   for (int i = 0; i < 10; ++i) {
9836 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9837     for (int j = 0; j < 10; ++j)
9838       ;
9839   }
9840 #pragma omp for simd
9841   for (int i = 0; i < 10; ++i) {
9842 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9843     for (int j = 0; j < 10; ++j)
9844       ;
9845   }
9846 #pragma omp for simd
9847   for (int i = 0; i < 10; ++i) {
9848 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9849     for (int j = 0; j < 10; ++j)
9850       ;
9851   }
9852 #pragma omp for simd
9853   for (int i = 0; i < 10; ++i) {
9854 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9855     for (int j = 0; j < 10; ++j)
9856       ;
9857   }
9858 #pragma omp for simd
9859   for (int i = 0; i < 10; ++i) {
9860 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9861     for (int j = 0; j < 10; ++j)
9862       ;
9863   }
9864 #pragma omp for simd
9865   for (int i = 0; i < 10; ++i) {
9866 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9867     a++;
9868   }
9869 #pragma omp for simd
9870   for (int i = 0; i < 10; ++i) {
9871 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9872     for (int j = 0; j < 10; ++j)
9873       ;
9874   }
9875 #pragma omp for simd
9876   for (int i = 0; i < 10; ++i) {
9877 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9878     for (int j = 0; j < 10; ++j)
9879       ;
9880   }
9881 #pragma omp for simd
9882   for (int i = 0; i < 10; ++i) {
9883 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9884     for (int j = 0; j < 10; ++j)
9885       ;
9886   }
9887 #pragma omp for simd
9888   for (int i = 0; i < 10; ++i) {
9889 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
9890     for (int j = 0; j < 10; ++j)
9891       ;
9892   }
9893 
9894 // SECTIONS DIRECTIVE
9895 #pragma omp sections
9896   {
9897 #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?}}
9898     for (int i = 0; i < 10; ++i)
9899       ;
9900   }
9901 #pragma omp sections
9902   {
9903 #pragma omp simd
9904     for (int i = 0; i < 10; ++i)
9905       ;
9906   }
9907 #pragma omp sections
9908   {
9909 #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?}}
9910     for (int i = 0; i < 10; ++i)
9911       ;
9912   }
9913 #pragma omp sections
9914   {
9915 #pragma omp parallel
9916     for (int i = 0; i < 10; ++i)
9917       ;
9918   }
9919 #pragma omp sections
9920   {
9921 #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?}}
9922     {
9923       bar();
9924     }
9925   }
9926 #pragma omp sections
9927   {
9928 #pragma omp section
9929     {
9930       bar();
9931     }
9932   }
9933 #pragma omp sections
9934   {
9935 #pragma omp critical
9936     bar();
9937 #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?}}
9938     bar();
9939 #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}}
9940     bar();
9941   }
9942 #pragma omp sections
9943   {
9944 #pragma omp parallel
9945     {
9946 #pragma omp single // OK
9947       {
9948         bar();
9949       }
9950 #pragma omp for // OK
9951       for (int i = 0; i < 10; ++i)
9952         ;
9953 #pragma omp for simd // OK
9954       for (int i = 0; i < 10; ++i)
9955         ;
9956 #pragma omp sections // OK
9957       {
9958         bar();
9959       }
9960     }
9961   }
9962 #pragma omp sections
9963   {
9964 #pragma omp parallel for
9965     for (int i = 0; i < 10; ++i)
9966       ;
9967   }
9968 #pragma omp sections
9969   {
9970 #pragma omp parallel for simd
9971     for (int i = 0; i < 10; ++i)
9972       ;
9973   }
9974 #pragma omp sections
9975   {
9976 #pragma omp parallel sections
9977     {
9978       bar();
9979     }
9980   }
9981 #pragma omp sections
9982   {
9983 #pragma omp task
9984     {
9985       bar();
9986     }
9987   }
9988 #pragma omp sections
9989   {
9990 #pragma omp taskyield
9991   }
9992 #pragma omp sections
9993   {
9994 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}}
9995     bar();
9996   }
9997 #pragma omp sections
9998   {
9999 #pragma omp taskwait
10000   }
10001 #pragma omp sections
10002   {
10003 #pragma omp flush
10004   }
10005 #pragma omp sections
10006   {
10007 #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?}}
10008     bar();
10009   }
10010 #pragma omp sections
10011   {
10012 #pragma omp atomic
10013     ++a;
10014   }
10015 #pragma omp sections
10016   {
10017 #pragma omp target
10018     ++a;
10019   }
10020 #pragma omp sections
10021   {
10022 #pragma omp target parallel
10023     ++a;
10024   }
10025 #pragma omp sections
10026   {
10027 #pragma omp target parallel for
10028     for (int i = 0; i < 10; ++i)
10029       ;
10030   }
10031 #pragma omp sections
10032   {
10033 #pragma omp target enter data map(to: a)
10034   }
10035 #pragma omp sections
10036   {
10037 #pragma omp target exit data map(from: a)
10038   }
10039 #pragma omp sections
10040   {
10041 #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?}}
10042     ++a;
10043   }
10044 #pragma omp sections
10045   {
10046 #pragma omp taskloop
10047   for (int i = 0; i < 10; ++i)
10048     ++a;
10049   }
10050 #pragma omp sections
10051   {
10052 #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?}}
10053     for (int i = 0; i < 10; ++i)
10054       ;
10055   }
10056 #pragma omp sections
10057   {
10058 #pragma omp target update to(a)
10059   }
10060 #pragma omp sections
10061   {
10062 #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?}}
10063     for (int i = 0; i < 10; ++i)
10064       ;
10065   }
10066 #pragma omp sections
10067   {
10068 #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?}}
10069     for (int i = 0; i < 10; ++i)
10070       ;
10071   }
10072 #pragma omp sections
10073   {
10074 #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?}}
10075     for (int i = 0; i < 10; ++i)
10076       ;
10077   }
10078 #pragma omp sections
10079   {
10080 #pragma omp target simd // OK
10081     for (int i = 0; i < 10; ++i)
10082       ;
10083   }
10084 #pragma omp sections
10085   {
10086 #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?}}
10087     for (int i = 0; i < 10; ++i)
10088       ;
10089   }
10090 #pragma omp sections
10091   {
10092 #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?}}
10093     for (int i = 0; i < 10; ++i)
10094       ;
10095   }
10096 #pragma omp sections
10097   {
10098 #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?}}
10099     for (int i = 0; i < 10; ++i)
10100       ;
10101   }
10102 #pragma omp sections
10103   {
10104 #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?}}
10105     for (int i = 0; i < 10; ++i)
10106       ;
10107   }
10108 #pragma omp sections
10109   {
10110 #pragma omp target teams // OK
10111     a++;
10112   }
10113 #pragma omp sections
10114   {
10115 #pragma omp target teams distribute // OK
10116     for (int i = 0; i < 10; ++i)
10117       ;
10118   }
10119 #pragma omp sections
10120   {
10121 #pragma omp target teams distribute parallel for // OK
10122     for (int i = 0; i < 10; ++i)
10123       ;
10124   }
10125 #pragma omp sections
10126   {
10127 #pragma omp target teams distribute parallel for simd // OK
10128     for (int i = 0; i < 10; ++i)
10129       ;
10130   }
10131 #pragma omp sections
10132   {
10133 #pragma omp target teams distribute simd // OK
10134     for (int i = 0; i < 10; ++i)
10135       ;
10136   }
10137 
10138 // SECTION DIRECTIVE
10139 #pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
10140   {
10141     bar();
10142   }
10143 #pragma omp sections
10144   {
10145 #pragma omp section
10146     {
10147 #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?}}
10148       for (int i = 0; i < 10; ++i)
10149         ;
10150     }
10151   }
10152 #pragma omp sections
10153   {
10154 #pragma omp section
10155     {
10156 #pragma omp simd
10157       for (int i = 0; i < 10; ++i)
10158         ;
10159     }
10160   }
10161 #pragma omp sections
10162   {
10163 #pragma omp section
10164     {
10165 #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?}}
10166       for (int i = 0; i < 10; ++i)
10167         ;
10168     }
10169   }
10170 #pragma omp sections
10171   {
10172 #pragma omp section
10173     {
10174 #pragma omp parallel
10175       for (int i = 0; i < 10; ++i)
10176         ;
10177     }
10178   }
10179 #pragma omp sections
10180   {
10181 #pragma omp section
10182     {
10183 #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?}}
10184       {
10185         bar();
10186       }
10187     }
10188   }
10189 #pragma omp sections
10190   {
10191 #pragma omp section
10192     {
10193 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a section region}}
10194       {
10195         bar();
10196       }
10197     }
10198   }
10199 #pragma omp sections
10200   {
10201 #pragma omp section
10202     {
10203 #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?}}
10204       bar();
10205 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
10206       bar();
10207 #pragma omp critical
10208       bar();
10209     }
10210   }
10211 #pragma omp sections
10212   {
10213 #pragma omp section
10214     {
10215 #pragma omp parallel
10216       {
10217 #pragma omp single // OK
10218         {
10219           bar();
10220         }
10221 #pragma omp for // OK
10222         for (int i = 0; i < 10; ++i)
10223           ;
10224 #pragma omp for simd // OK
10225         for (int i = 0; i < 10; ++i)
10226           ;
10227 #pragma omp sections // OK
10228         {
10229           bar();
10230         }
10231       }
10232     }
10233   }
10234 #pragma omp sections
10235   {
10236 #pragma omp section
10237     {
10238 #pragma omp parallel for
10239       for (int i = 0; i < 10; ++i)
10240         ;
10241     }
10242   }
10243 #pragma omp sections
10244   {
10245 #pragma omp section
10246     {
10247 #pragma omp parallel for simd
10248       for (int i = 0; i < 10; ++i)
10249         ;
10250     }
10251   }
10252 #pragma omp sections
10253   {
10254 #pragma omp section
10255     {
10256 #pragma omp parallel sections
10257       {
10258         bar();
10259       }
10260     }
10261   }
10262 #pragma omp sections
10263   {
10264 #pragma omp section
10265     {
10266 #pragma omp task
10267       {
10268         bar();
10269       }
10270     }
10271   }
10272 #pragma omp sections
10273   {
10274 #pragma omp section
10275     {
10276 #pragma omp taskyield
10277       bar();
10278     }
10279   }
10280 #pragma omp sections
10281   {
10282 #pragma omp section
10283     {
10284 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'section' region}}
10285       bar();
10286     }
10287   }
10288 #pragma omp sections
10289   {
10290 #pragma omp section
10291     {
10292 #pragma omp taskwait
10293       bar();
10294     }
10295   }
10296 #pragma omp sections
10297   {
10298 #pragma omp section
10299     {
10300 #pragma omp flush
10301       bar();
10302     }
10303   }
10304 #pragma omp sections
10305   {
10306 #pragma omp section
10307     {
10308 #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?}}
10309       bar();
10310     }
10311   }
10312 #pragma omp sections
10313   {
10314 #pragma omp section
10315     {
10316 #pragma omp atomic
10317       ++a;
10318     }
10319   }
10320 #pragma omp sections
10321   {
10322 #pragma omp section
10323     {
10324 #pragma omp target
10325       ++a;
10326     }
10327   }
10328 #pragma omp sections
10329   {
10330 #pragma omp section
10331     {
10332 #pragma omp target parallel
10333       ++a;
10334     }
10335   }
10336 #pragma omp sections
10337   {
10338 #pragma omp section
10339     {
10340 #pragma omp target parallel for
10341       for (int i = 0; i < 10; ++i)
10342         ;
10343     }
10344   }
10345 #pragma omp sections
10346   {
10347 #pragma omp section
10348     {
10349 #pragma omp target enter data map(to: a)
10350       ++a;
10351     }
10352   }
10353 #pragma omp sections
10354   {
10355 #pragma omp section
10356     {
10357 #pragma omp target exit data map(from: a)
10358       ++a;
10359     }
10360   }
10361 #pragma omp sections
10362   {
10363 #pragma omp section
10364     {
10365 #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?}}
10366       ++a;
10367     }
10368   }
10369 #pragma omp sections
10370   {
10371 #pragma omp section
10372     {
10373 #pragma omp taskloop
10374   for (int i = 0; i < 10; ++i)
10375       ++a;
10376     }
10377   }
10378 #pragma omp sections
10379   {
10380 #pragma omp section
10381 #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?}}
10382     for (int i = 0; i < 10; ++i)
10383       ;
10384   }
10385 #pragma omp sections
10386   {
10387 #pragma omp section
10388     {
10389 #pragma omp target update to(a)
10390       a++;
10391     }
10392   }
10393 #pragma omp sections
10394   {
10395 #pragma omp section
10396 #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?}}
10397     for (int i = 0; i < 10; ++i)
10398       ;
10399   }
10400 #pragma omp sections
10401   {
10402 #pragma omp section
10403 #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?}}
10404     for (int i = 0; i < 10; ++i)
10405       ;
10406   }
10407 #pragma omp sections
10408   {
10409 #pragma omp section
10410 #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?}}
10411     for (int i = 0; i < 10; ++i)
10412       ;
10413   }
10414 #pragma omp sections
10415   {
10416 #pragma omp section
10417 #pragma omp target simd // OK
10418     for (int i = 0; i < 10; ++i)
10419       ;
10420   }
10421 #pragma omp sections
10422   {
10423 #pragma omp section
10424 #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?}}
10425     for (int i = 0; i < 10; ++i)
10426       ;
10427   }
10428 #pragma omp sections
10429   {
10430 #pragma omp section
10431 #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?}}
10432     for (int i = 0; i < 10; ++i)
10433       ;
10434   }
10435 #pragma omp sections
10436   {
10437 #pragma omp section
10438 #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?}}
10439     for (int i = 0; i < 10; ++i)
10440       ;
10441   }
10442 #pragma omp sections
10443   {
10444 #pragma omp section
10445 #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?}}
10446     for (int i = 0; i < 10; ++i)
10447       ;
10448   }
10449 #pragma omp sections
10450   {
10451 #pragma omp section
10452 #pragma omp target teams // OK
10453     a++;
10454   }
10455 #pragma omp sections
10456   {
10457 #pragma omp section
10458 #pragma omp target teams distribute // OK
10459     for (int i = 0; i < 10; ++i)
10460       ;
10461   }
10462 #pragma omp sections
10463   {
10464 #pragma omp section
10465 #pragma omp target teams distribute parallel for // OK
10466     for (int i = 0; i < 10; ++i)
10467       ;
10468   }
10469 #pragma omp sections
10470   {
10471 #pragma omp section
10472 #pragma omp target teams distribute parallel for simd // OK
10473     for (int i = 0; i < 10; ++i)
10474       ;
10475   }
10476 #pragma omp sections
10477   {
10478 #pragma omp section
10479 #pragma omp target teams distribute simd // OK
10480     for (int i = 0; i < 10; ++i)
10481       ;
10482   }
10483 
10484 // SINGLE DIRECTIVE
10485 #pragma omp single
10486   {
10487 #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?}}
10488     for (int i = 0; i < 10; ++i)
10489       ;
10490   }
10491 #pragma omp single
10492   {
10493 #pragma omp simd
10494     for (int i = 0; i < 10; ++i)
10495       ;
10496   }
10497 #pragma omp single
10498   {
10499 #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?}}
10500     for (int i = 0; i < 10; ++i)
10501       ;
10502   }
10503 #pragma omp single
10504   {
10505 #pragma omp parallel
10506     for (int i = 0; i < 10; ++i)
10507       ;
10508   }
10509 #pragma omp single
10510   {
10511 #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?}}
10512     {
10513       bar();
10514     }
10515 #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}}
10516     bar();
10517 #pragma omp critical
10518     bar();
10519   }
10520 #pragma omp single
10521   {
10522 #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?}}
10523     {
10524       bar();
10525     }
10526   }
10527 #pragma omp single
10528   {
10529 #pragma omp parallel
10530     {
10531 #pragma omp single // OK
10532       {
10533         bar();
10534       }
10535 #pragma omp for // OK
10536       for (int i = 0; i < 10; ++i)
10537         ;
10538 #pragma omp for simd // OK
10539       for (int i = 0; i < 10; ++i)
10540         ;
10541 #pragma omp sections // OK
10542       {
10543         bar();
10544       }
10545     }
10546   }
10547 #pragma omp single
10548   {
10549 #pragma omp parallel for
10550     for (int i = 0; i < 10; ++i)
10551       ;
10552   }
10553 #pragma omp single
10554   {
10555 #pragma omp parallel for simd
10556     for (int i = 0; i < 10; ++i)
10557       ;
10558   }
10559 #pragma omp single
10560   {
10561 #pragma omp parallel sections
10562     {
10563       bar();
10564     }
10565   }
10566 #pragma omp single
10567   {
10568 #pragma omp task
10569     {
10570       bar();
10571     }
10572   }
10573 #pragma omp single
10574   {
10575 #pragma omp taskyield
10576     bar();
10577   }
10578 #pragma omp single
10579   {
10580 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}}
10581     bar();
10582   }
10583 #pragma omp single
10584   {
10585 #pragma omp taskwait
10586     bar();
10587   }
10588 #pragma omp single
10589   {
10590 #pragma omp flush
10591     bar();
10592   }
10593 #pragma omp single
10594   {
10595 #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?}}
10596     bar();
10597   }
10598 #pragma omp single
10599   {
10600 #pragma omp atomic
10601     ++a;
10602   }
10603 #pragma omp single
10604   {
10605 #pragma omp target
10606     ++a;
10607   }
10608 #pragma omp single
10609   {
10610 #pragma omp target parallel
10611     ++a;
10612   }
10613 #pragma omp single
10614   {
10615 #pragma omp target parallel for
10616     for (int i = 0; i < 10; ++i)
10617       ;
10618   }
10619 #pragma omp single
10620   {
10621 #pragma omp target enter data map(to: a)
10622     ++a;
10623   }
10624 #pragma omp single
10625   {
10626 #pragma omp target exit data map(from: a)
10627     ++a;
10628   }
10629 #pragma omp single
10630   {
10631 #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?}}
10632     ++a;
10633   }
10634 #pragma omp single
10635   {
10636 #pragma omp taskloop
10637   for (int i = 0; i < 10; ++i)
10638     ++a;
10639   }
10640 #pragma omp single
10641   {
10642 #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?}}
10643     for (int i = 0; i < 10; ++i)
10644       ;
10645   }
10646 #pragma omp single
10647   {
10648 #pragma omp target update to(a)
10649     a++;
10650   }
10651 #pragma omp single
10652   {
10653 #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?}}
10654     for (int i = 0; i < 10; ++i)
10655       ;
10656   }
10657 #pragma omp single
10658   {
10659 #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?}}
10660     for (int i = 0; i < 10; ++i)
10661       ;
10662   }
10663 #pragma omp single
10664   {
10665 #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?}}
10666     for (int i = 0; i < 10; ++i)
10667       ;
10668   }
10669 #pragma omp single
10670   {
10671 #pragma omp target simd // OK
10672     for (int i = 0; i < 10; ++i)
10673       ;
10674   }
10675 #pragma omp single
10676   {
10677 #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?}}
10678     for (int i = 0; i < 10; ++i)
10679       ;
10680   }
10681 #pragma omp single
10682   {
10683 #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?}}
10684     for (int i = 0; i < 10; ++i)
10685       ;
10686   }
10687 #pragma omp single
10688   {
10689 #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?}}
10690     for (int i = 0; i < 10; ++i)
10691       ;
10692   }
10693 #pragma omp single
10694   {
10695 #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?}}
10696     for (int i = 0; i < 10; ++i)
10697       ;
10698   }
10699 #pragma omp single
10700   {
10701 #pragma omp target teams // oK
10702     a++;
10703   }
10704 #pragma omp single
10705   {
10706 #pragma omp target teams distribute // OK
10707     for (int i = 0; i < 10; ++i)
10708       ;
10709   }
10710 #pragma omp single
10711   {
10712 #pragma omp target teams distribute parallel for // OK
10713     for (int i = 0; i < 10; ++i)
10714       ;
10715   }
10716 #pragma omp single
10717   {
10718 #pragma omp target teams distribute parallel for simd // OK
10719     for (int i = 0; i < 10; ++i)
10720       ;
10721   }
10722 #pragma omp single
10723   {
10724 #pragma omp target teams distribute simd // OK
10725     for (int i = 0; i < 10; ++i)
10726       ;
10727   }
10728 
10729 // MASTER DIRECTIVE
10730 #pragma omp master
10731   {
10732 #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?}}
10733     for (int i = 0; i < 10; ++i)
10734       ;
10735   }
10736 #pragma omp master
10737   {
10738 #pragma omp simd
10739     for (int i = 0; i < 10; ++i)
10740       ;
10741   }
10742 #pragma omp master
10743   {
10744 #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?}}
10745     for (int i = 0; i < 10; ++i)
10746       ;
10747   }
10748 #pragma omp master
10749   {
10750 #pragma omp parallel
10751     for (int i = 0; i < 10; ++i)
10752       ;
10753   }
10754 #pragma omp master
10755   {
10756 #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?}}
10757     {
10758       bar();
10759     }
10760   }
10761 #pragma omp master
10762   {
10763 #pragma omp master // OK, though second 'master' is redundant
10764     {
10765       bar();
10766     }
10767   }
10768 #pragma omp master
10769   {
10770 #pragma omp critical
10771     {
10772       bar();
10773     }
10774   }
10775 #pragma omp master
10776   {
10777 #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?}}
10778     {
10779       bar();
10780     }
10781   }
10782 #pragma omp master
10783   {
10784 #pragma omp parallel
10785     {
10786 #pragma omp master // OK
10787       {
10788         bar();
10789       }
10790 #pragma omp for // OK
10791       for (int i = 0; i < 10; ++i)
10792         ;
10793 #pragma omp for simd // OK
10794       for (int i = 0; i < 10; ++i)
10795         ;
10796 #pragma omp sections // OK
10797       {
10798         bar();
10799       }
10800     }
10801   }
10802 #pragma omp master
10803   {
10804 #pragma omp parallel for
10805     for (int i = 0; i < 10; ++i)
10806       ;
10807   }
10808 #pragma omp master
10809   {
10810 #pragma omp parallel for simd
10811     for (int i = 0; i < 10; ++i)
10812       ;
10813   }
10814 #pragma omp master
10815   {
10816 #pragma omp parallel sections
10817     {
10818       bar();
10819     }
10820   }
10821 #pragma omp master
10822   {
10823 #pragma omp task
10824     {
10825       bar();
10826     }
10827   }
10828 #pragma omp master
10829   {
10830 #pragma omp taskyield
10831     bar();
10832   }
10833 #pragma omp master
10834   {
10835 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}}
10836     bar();
10837   }
10838 #pragma omp master
10839   {
10840 #pragma omp taskwait
10841     bar();
10842   }
10843 #pragma omp master
10844   {
10845 #pragma omp flush
10846     bar();
10847   }
10848 #pragma omp master
10849   {
10850 #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?}}
10851     bar();
10852   }
10853 #pragma omp master
10854   {
10855 #pragma omp atomic
10856     ++a;
10857   }
10858 #pragma omp master
10859   {
10860 #pragma omp target
10861     ++a;
10862   }
10863 #pragma omp master
10864   {
10865 #pragma omp target parallel
10866     ++a;
10867   }
10868 #pragma omp master
10869   {
10870 #pragma omp target parallel for
10871     for (int i = 0; i < 10; ++i)
10872       ;
10873   }
10874 #pragma omp master
10875   {
10876 #pragma omp target enter data map(to: a)
10877     ++a;
10878   }
10879 #pragma omp master
10880   {
10881 #pragma omp target exit data map(from: a)
10882     ++a;
10883   }
10884 #pragma omp master
10885   {
10886 #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?}}
10887     ++a;
10888   }
10889 #pragma omp master
10890   {
10891 #pragma omp taskloop
10892   for (int i = 0; i < 10; ++i)
10893     ++a;
10894   }
10895 #pragma omp master
10896   {
10897 #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?}}
10898     for (int i = 0; i < 10; ++i)
10899       ;
10900   }
10901 #pragma omp master
10902   {
10903 #pragma omp target update to(a)
10904     ++a;
10905   }
10906 #pragma omp master
10907   {
10908 #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?}}
10909     for (int i = 0; i < 10; ++i)
10910       ;
10911   }
10912 #pragma omp master
10913   {
10914 #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?}}
10915     for (int i = 0; i < 10; ++i)
10916       ;
10917   }
10918 #pragma omp master
10919   {
10920 #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?}}
10921     for (int i = 0; i < 10; ++i)
10922       ;
10923   }
10924 #pragma omp master
10925   {
10926 #pragma omp target simd // OK
10927     for (int i = 0; i < 10; ++i)
10928       ;
10929   }
10930 #pragma omp master
10931   {
10932 #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?}}
10933     for (int i = 0; i < 10; ++i)
10934       ;
10935   }
10936 #pragma omp master
10937   {
10938 #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?}}
10939     for (int i = 0; i < 10; ++i)
10940       ;
10941   }
10942 #pragma omp master
10943   {
10944 #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?}}
10945     for (int i = 0; i < 10; ++i)
10946       ;
10947   }
10948 #pragma omp master
10949   {
10950 #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?}}
10951     for (int i = 0; i < 10; ++i)
10952       ;
10953   }
10954 #pragma omp master
10955   {
10956 #pragma omp target teams // OK
10957     a++;
10958   }
10959 #pragma omp master
10960   {
10961 #pragma omp target teams distribute // OK
10962     for (int i = 0; i < 10; ++i)
10963       ;
10964   }
10965 #pragma omp master
10966   {
10967 #pragma omp target teams distribute parallel for // OK
10968     for (int i = 0; i < 10; ++i)
10969       ;
10970   }
10971 #pragma omp master
10972   {
10973 #pragma omp target teams distribute parallel for simd // OK
10974     for (int i = 0; i < 10; ++i)
10975       ;
10976   }
10977 #pragma omp master
10978   {
10979 #pragma omp target teams distribute simd // OK
10980     for (int i = 0; i < 10; ++i)
10981       ;
10982   }
10983 
10984 // CRITICAL DIRECTIVE
10985 #pragma omp critical
10986   {
10987 #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?}}
10988     for (int i = 0; i < 10; ++i)
10989       ;
10990   }
10991 #pragma omp critical
10992   {
10993 #pragma omp simd
10994     for (int i = 0; i < 10; ++i)
10995       ;
10996   }
10997 #pragma omp critical
10998   {
10999 #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?}}
11000     for (int i = 0; i < 10; ++i)
11001       ;
11002   }
11003 #pragma omp critical
11004   {
11005 #pragma omp parallel
11006     for (int i = 0; i < 10; ++i)
11007       ;
11008   }
11009 #pragma omp critical
11010   {
11011 #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?}}
11012     {
11013       bar();
11014     }
11015   }
11016 #pragma omp critical
11017   {
11018 #pragma omp master // OK, though second 'master' is redundant
11019     {
11020       bar();
11021     }
11022   }
11023 #pragma omp critical
11024   {
11025 #pragma omp critical
11026     {
11027       bar();
11028     }
11029   }
11030 #pragma omp critical
11031   {
11032 #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?}}
11033     {
11034       bar();
11035     }
11036   }
11037 #pragma omp critical
11038   {
11039 #pragma omp parallel
11040     {
11041 #pragma omp master // OK
11042       {
11043         bar();
11044       }
11045 #pragma omp for // OK
11046       for (int i = 0; i < 10; ++i)
11047         ;
11048 #pragma omp for simd // OK
11049       for (int i = 0; i < 10; ++i)
11050         ;
11051 #pragma omp sections // OK
11052       {
11053         bar();
11054       }
11055     }
11056   }
11057 #pragma omp critical
11058   {
11059 #pragma omp parallel for
11060     for (int i = 0; i < 10; ++i)
11061       ;
11062   }
11063 #pragma omp critical
11064   {
11065 #pragma omp parallel for simd
11066     for (int i = 0; i < 10; ++i)
11067       ;
11068   }
11069 #pragma omp critical
11070   {
11071 #pragma omp parallel sections
11072     {
11073       bar();
11074     }
11075   }
11076 #pragma omp critical
11077   {
11078 #pragma omp task
11079     {
11080       bar();
11081     }
11082   }
11083 #pragma omp critical
11084   {
11085 #pragma omp taskyield
11086     bar();
11087   }
11088 #pragma omp critical
11089   {
11090 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'critical' region}}
11091     bar();
11092   }
11093 #pragma omp critical
11094   {
11095 #pragma omp taskwait
11096     bar();
11097   }
11098 #pragma omp critical(Belka)
11099   {
11100 #pragma omp critical(Strelka)
11101     bar();
11102   }
11103 #pragma omp critical(Tuzik) // expected-note {{previous 'critical' region starts here}}
11104   {
11105 #pragma omp critical(grelka) // expected-note {{previous 'critical' region starts here}}
11106     {
11107 #pragma omp critical(Tuzik) // expected-error {{cannot nest 'critical' regions having the same name 'Tuzik'}}
11108       {
11109 #pragma omp parallel
11110 #pragma omp critical(grelka) // expected-error {{cannot nest 'critical' regions having the same name 'grelka'}}
11111         {
11112           bar();
11113         }
11114       }
11115     }
11116   }
11117 #pragma omp critical
11118   {
11119 #pragma omp flush
11120     bar();
11121   }
11122 #pragma omp critical
11123   {
11124 #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?}}
11125     bar();
11126   }
11127 #pragma omp critical
11128   {
11129 #pragma omp atomic
11130     ++a;
11131   }
11132 #pragma omp critical
11133   {
11134 #pragma omp target
11135     ++a;
11136   }
11137 #pragma omp critical
11138   {
11139 #pragma omp target parallel
11140     ++a;
11141   }
11142 #pragma omp critical
11143   {
11144 #pragma omp target parallel for
11145     for (int i = 0; i < 10; ++i)
11146       ;
11147   }
11148 #pragma omp critical
11149   {
11150 #pragma omp target enter data map(to: a)
11151     ++a;
11152   }
11153 #pragma omp critical
11154   {
11155 #pragma omp target exit data map(from: a)
11156     ++a;
11157   }
11158 #pragma omp critical
11159   {
11160 #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?}}
11161     ++a;
11162   }
11163 #pragma omp critical
11164   {
11165 #pragma omp taskloop
11166   for (int i = 0; i < 10; ++i)
11167     ++a;
11168   }
11169 #pragma omp critical
11170   {
11171 #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?}}
11172     for (int i = 0; i < 10; ++i)
11173       ;
11174   }
11175 #pragma omp critical
11176   {
11177 #pragma omp target update to(a)
11178     a++;
11179   }
11180 #pragma omp critical
11181   {
11182 #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?}}
11183     for (int i = 0; i < 10; ++i)
11184       ;
11185   }
11186 #pragma omp critical
11187   {
11188 #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?}}
11189     for (int i = 0; i < 10; ++i)
11190       ;
11191   }
11192 #pragma omp critical
11193   {
11194 #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?}}
11195     for (int i = 0; i < 10; ++i)
11196       ;
11197   }
11198 #pragma omp critical
11199   {
11200 #pragma omp target simd // OK
11201     for (int i = 0; i < 10; ++i)
11202       ;
11203   }
11204 #pragma omp critical
11205   {
11206 #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?}}
11207     for (int i = 0; i < 10; ++i)
11208       ;
11209   }
11210 #pragma omp critical
11211   {
11212 #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?}}
11213     for (int i = 0; i < 10; ++i)
11214       ;
11215   }
11216 #pragma omp critical
11217   {
11218 #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?}}
11219     for (int i = 0; i < 10; ++i)
11220       ;
11221   }
11222 #pragma omp critical
11223   {
11224 #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?}}
11225     for (int i = 0; i < 10; ++i)
11226       ;
11227   }
11228 #pragma omp critical
11229   {
11230 #pragma omp target teams // OK
11231     a++;
11232   }
11233 #pragma omp critical
11234   {
11235 #pragma omp target teams distribute // OK
11236     for (int i = 0; i < 10; ++i)
11237       ;
11238   }
11239 #pragma omp critical
11240   {
11241 #pragma omp target teams distribute parallel for // OK
11242     for (int i = 0; i < 10; ++i)
11243       ;
11244   }
11245 #pragma omp critical
11246   {
11247 #pragma omp target teams distribute parallel for simd // OK
11248     for (int i = 0; i < 10; ++i)
11249       ;
11250   }
11251 #pragma omp critical
11252   {
11253 #pragma omp target teams distribute simd // OK
11254     for (int i = 0; i < 10; ++i)
11255       ;
11256   }
11257 
11258 // PARALLEL FOR DIRECTIVE
11259 #pragma omp parallel for
11260   for (int i = 0; i < 10; ++i) {
11261 #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?}}
11262     for (int i = 0; i < 10; ++i)
11263       ;
11264   }
11265 #pragma omp parallel for
11266   for (int i = 0; i < 10; ++i) {
11267 #pragma omp simd
11268     for (int i = 0; i < 10; ++i)
11269       ;
11270   }
11271 #pragma omp parallel for
11272   for (int i = 0; i < 10; ++i) {
11273 #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?}}
11274     for (int i = 0; i < 10; ++i)
11275       ;
11276   }
11277 
11278 #pragma omp parallel for
11279   for (int i = 0; i < 10; ++i) {
11280 #pragma omp parallel
11281     for (int i = 0; i < 10; ++i)
11282       ;
11283   }
11284 #pragma omp parallel for
11285   for (int i = 0; i < 10; ++i) {
11286 #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?}}
11287     {
11288       bar();
11289     }
11290   }
11291 #pragma omp parallel for
11292   for (int i = 0; i < 10; ++i) {
11293 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a parallel for region}}
11294     {
11295       bar();
11296     }
11297   }
11298 #pragma omp parallel for
11299   for (int i = 0; i < 10; ++i) {
11300 #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?}}
11301     {
11302       bar();
11303     }
11304 #pragma omp master // expected-error {{region cannot be closely nested inside 'parallel for' region}}
11305     {
11306       bar();
11307     }
11308 #pragma omp critical
11309     {
11310       bar();
11311     }
11312   }
11313 #pragma omp parallel for
11314   for (int i = 0; i < 10; ++i) {
11315 #pragma omp parallel
11316     {
11317 #pragma omp single // OK
11318       {
11319         bar();
11320       }
11321 #pragma omp master // OK
11322       {
11323         bar();
11324       }
11325 #pragma omp critical // OK
11326       {
11327         bar();
11328       }
11329 #pragma omp for // OK
11330       for (int i = 0; i < 10; ++i)
11331         ;
11332 #pragma omp for simd // OK
11333       for (int i = 0; i < 10; ++i)
11334         ;
11335 #pragma omp sections // OK
11336       {
11337         bar();
11338       }
11339     }
11340   }
11341 #pragma omp parallel for
11342   for (int i = 0; i < 10; ++i) {
11343 #pragma omp parallel for
11344     for (int i = 0; i < 10; ++i)
11345       ;
11346   }
11347 #pragma omp parallel for
11348   for (int i = 0; i < 10; ++i) {
11349 #pragma omp parallel for simd
11350     for (int i = 0; i < 10; ++i)
11351       ;
11352   }
11353 #pragma omp parallel for
11354   for (int i = 0; i < 10; ++i) {
11355 #pragma omp parallel sections
11356     {
11357       bar();
11358     }
11359   }
11360 #pragma omp parallel for
11361   for (int i = 0; i < 10; ++i) {
11362 #pragma omp task
11363     {
11364       bar();
11365     }
11366   }
11367 #pragma omp parallel for
11368   for (int i = 0; i < 10; ++i) {
11369 #pragma omp taskyield
11370     bar();
11371   }
11372 #pragma omp parallel for
11373   for (int i = 0; i < 10; ++i) {
11374 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}}
11375     bar();
11376   }
11377 #pragma omp parallel for
11378   for (int i = 0; i < 10; ++i) {
11379 #pragma omp taskwait
11380     bar();
11381   }
11382 #pragma omp parallel for
11383   for (int i = 0; i < 10; ++i) {
11384 #pragma omp flush
11385     bar();
11386   }
11387 #pragma omp parallel for
11388   for (int i = 0; i < 10; ++i) {
11389 #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?}}
11390     bar();
11391   }
11392 #pragma omp parallel for ordered
11393   for (int i = 0; i < 10; ++i) {
11394 #pragma omp ordered // OK
11395     bar();
11396   }
11397 #pragma omp parallel for
11398   for (int i = 0; i < 10; ++i) {
11399 #pragma omp atomic
11400     ++a;
11401   }
11402 #pragma omp parallel for
11403   for (int i = 0; i < 10; ++i) {
11404 #pragma omp target
11405     ++a;
11406   }
11407 #pragma omp parallel for
11408   for (int i = 0; i < 10; ++i) {
11409 #pragma omp target parallel
11410     ++a;
11411   }
11412 #pragma omp parallel for
11413   for (int i = 0; i < 10; ++i) {
11414 #pragma omp target parallel for
11415     for (int i = 0; i < 10; ++i)
11416       ;
11417   }
11418 #pragma omp parallel for
11419   for (int i = 0; i < 10; ++i) {
11420 #pragma omp target enter data map(to: a)
11421     ++a;
11422   }
11423 #pragma omp parallel for
11424   for (int i = 0; i < 10; ++i) {
11425 #pragma omp target exit data map(from: a)
11426     ++a;
11427   }
11428 #pragma omp parallel for
11429   for (int i = 0; i < 10; ++i) {
11430 #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?}}
11431     ++a;
11432   }
11433 #pragma omp parallel for
11434   for (int i = 0; i < 10; ++i) {
11435 #pragma omp taskloop
11436   for (int i = 0; i < 10; ++i)
11437     ++a;
11438   }
11439 #pragma omp parallel for
11440   for (int i = 0; i < 10; ++i) {
11441 #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?}}
11442     for (int j = 0; j < 10; ++j)
11443       ;
11444   }
11445 #pragma omp parallel for
11446   for (int i = 0; i < 10; ++i) {
11447 #pragma omp target update to(a)
11448     a++;
11449   }
11450 #pragma omp parallel for
11451   for (int i = 0; i < 10; ++i) {
11452 #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?}}
11453     for (int j = 0; j < 10; ++j)
11454       ;
11455   }
11456 #pragma omp parallel for
11457   for (int i = 0; i < 10; ++i) {
11458 #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?}}
11459     for (int j = 0; j < 10; ++j)
11460       ;
11461   }
11462 #pragma omp parallel for
11463   for (int i = 0; i < 10; ++i) {
11464 #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?}}
11465     for (int j = 0; j < 10; ++j)
11466       ;
11467   }
11468 #pragma omp parallel for
11469   for (int i = 0; i < 10; ++i) {
11470 #pragma omp target simd // OK
11471     for (int j = 0; j < 10; ++j)
11472       ;
11473   }
11474 #pragma omp parallel for
11475   for (int i = 0; i < 10; ++i) {
11476 #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?}}
11477     for (int j = 0; j < 10; ++j)
11478       ;
11479   }
11480 #pragma omp parallel for
11481   for (int i = 0; i < 10; ++i) {
11482 #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?}}
11483     for (int j = 0; j < 10; ++j)
11484       ;
11485   }
11486 #pragma omp parallel for
11487   for (int i = 0; i < 10; ++i) {
11488 #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?}}
11489     for (int j = 0; j < 10; ++j)
11490       ;
11491   }
11492 #pragma omp parallel for
11493   for (int i = 0; i < 10; ++i) {
11494 #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?}}
11495     for (int j = 0; j < 10; ++j)
11496       ;
11497   }
11498 #pragma omp parallel for
11499   for (int i = 0; i < 10; ++i) {
11500 #pragma omp target teams // OK
11501     a++;
11502   }
11503 #pragma omp parallel for
11504   for (int i = 0; i < 10; ++i) {
11505 #pragma omp target teams distribute // OK
11506     for (int j = 0; j < 10; ++j)
11507       ;
11508   }
11509 #pragma omp parallel for
11510   for (int i = 0; i < 10; ++i) {
11511 #pragma omp target teams distribute parallel for // OK
11512     for (int j = 0; j < 10; ++j)
11513       ;
11514   }
11515 #pragma omp parallel for
11516   for (int i = 0; i < 10; ++i) {
11517 #pragma omp target teams distribute parallel for simd // OK
11518     for (int j = 0; j < 10; ++j)
11519       ;
11520   }
11521 #pragma omp parallel for
11522   for (int i = 0; i < 10; ++i) {
11523 #pragma omp target teams distribute simd // OK
11524     for (int j = 0; j < 10; ++j)
11525       ;
11526   }
11527 
11528 // PARALLEL FOR SIMD DIRECTIVE
11529 #pragma omp parallel for simd
11530   for (int i = 0; i < 10; ++i) {
11531 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11532     for (int i = 0; i < 10; ++i)
11533       ;
11534   }
11535 #pragma omp parallel for simd
11536   for (int i = 0; i < 10; ++i) {
11537 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
11538     for (int i = 0; i < 10; ++i)
11539       ;
11540   }
11541 #pragma omp parallel for simd
11542   for (int i = 0; i < 10; ++i) {
11543 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11544     for (int i = 0; i < 10; ++i)
11545       ;
11546   }
11547 #pragma omp parallel for simd
11548   for (int i = 0; i < 10; ++i) {
11549 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11550     for (int i = 0; i < 10; ++i)
11551       ;
11552   }
11553 #pragma omp parallel for simd
11554   for (int i = 0; i < 10; ++i) {
11555 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11556     {
11557       bar();
11558     }
11559   }
11560 #pragma omp parallel for simd
11561   for (int i = 0; i < 10; ++i) {
11562 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11563     {
11564       bar();
11565     }
11566   }
11567 #pragma omp parallel for simd
11568   for (int i = 0; i < 10; ++i) {
11569 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11570     {
11571       bar();
11572     }
11573   }
11574 
11575 #pragma omp parallel for simd
11576   for (int i = 0; i < 10; ++i) {
11577 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11578     {
11579       bar();
11580     }
11581   }
11582 
11583 #pragma omp parallel for simd
11584   for (int i = 0; i < 10; ++i) {
11585 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11586     {
11587       bar();
11588     }
11589   }
11590 
11591 #pragma omp parallel for simd
11592   for (int i = 0; i < 10; ++i) {
11593 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11594     {
11595 #pragma omp single
11596       {
11597         bar();
11598       }
11599 #pragma omp for
11600       for (int i = 0; i < 10; ++i)
11601         ;
11602 #pragma omp for simd
11603       for (int i = 0; i < 10; ++i)
11604         ;
11605 #pragma omp sections
11606       {
11607         bar();
11608       }
11609     }
11610   }
11611 #pragma omp parallel for simd
11612   for (int i = 0; i < 10; ++i) {
11613 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11614     for (int i = 0; i < 10; ++i)
11615       ;
11616   }
11617 #pragma omp parallel for simd
11618   for (int i = 0; i < 10; ++i) {
11619 #pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
11620     for (int i = 0; i < 10; ++i)
11621       ;
11622   }
11623 #pragma omp parallel for simd
11624   for (int i = 0; i < 10; ++i) {
11625 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11626     {
11627       bar();
11628     }
11629   }
11630 #pragma omp parallel for simd
11631   for (int i = 0; i < 10; ++i) {
11632 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11633     {
11634       bar();
11635     }
11636   }
11637 #pragma omp parallel for simd
11638   for (int i = 0; i < 10; ++i) {
11639 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11640     bar();
11641   }
11642 #pragma omp parallel for simd
11643   for (int i = 0; i < 10; ++i) {
11644 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11645     bar();
11646   }
11647 #pragma omp parallel for simd
11648   for (int i = 0; i < 10; ++i) {
11649 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11650     bar();
11651   }
11652 #pragma omp parallel for simd
11653   for (int i = 0; i < 10; ++i) {
11654 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11655     bar();
11656   }
11657 #pragma omp parallel for simd
11658   for (int i = 0; i < 10; ++i) {
11659 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11660     bar();
11661   }
11662 #pragma omp parallel for simd
11663   for (int i = 0; i < 10; ++i) {
11664 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11665     bar();
11666   }
11667 #pragma omp parallel for simd
11668   for (int i = 0; i < 10; ++i) {
11669 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11670     ++a;
11671   }
11672 #pragma omp parallel for simd
11673   for (int i = 0; i < 10; ++i) {
11674 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11675     ++a;
11676   }
11677 #pragma omp parallel for simd
11678   for (int i = 0; i < 10; ++i) {
11679 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11680     ++a;
11681   }
11682 #pragma omp parallel for simd
11683   for (int i = 0; i < 10; ++i) {
11684 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11685     for (int i = 0; i < 10; ++i)
11686       ;
11687   }
11688 #pragma omp parallel for simd
11689   for (int i = 0; i < 10; ++i) {
11690 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11691     ++a;
11692   }
11693 #pragma omp parallel for simd
11694   for (int i = 0; i < 10; ++i) {
11695 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11696     ++a;
11697   }
11698 #pragma omp parallel for simd
11699   for (int i = 0; i < 10; ++i) {
11700 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11701     ++a;
11702   }
11703 #pragma omp parallel for simd
11704   for (int i = 0; i < 10; ++i) {
11705 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11706   for (int i = 0; i < 10; ++i)
11707     ++a;
11708   }
11709 #pragma omp parallel for simd
11710   for (int i = 0; i < 10; ++i) {
11711 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11712     for (int j = 0; j < 10; ++j)
11713       ;
11714   }
11715 #pragma omp parallel for simd
11716   for (int i = 0; i < 10; ++i) {
11717 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11718     a++;
11719   }
11720 #pragma omp parallel for simd
11721   for (int i = 0; i < 10; ++i) {
11722 #pragma omp distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11723     for (int j = 0; j < 10; ++j)
11724       ;
11725   }
11726 #pragma omp parallel for simd
11727   for (int i = 0; i < 10; ++i) {
11728 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11729     for (int j = 0; j < 10; ++j)
11730       ;
11731   }
11732 #pragma omp parallel for simd
11733   for (int i = 0; i < 10; ++i) {
11734 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11735     for (int j = 0; j < 10; ++j)
11736       ;
11737   }
11738 #pragma omp parallel for simd
11739   for (int i = 0; i < 10; ++i) {
11740 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11741     for (int j = 0; j < 10; ++j)
11742       ;
11743   }
11744 #pragma omp parallel for simd
11745   for (int i = 0; i < 10; ++i) {
11746 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11747     for (int j = 0; j < 10; ++j)
11748       ;
11749   }
11750 #pragma omp parallel for simd
11751   for (int i = 0; i < 10; ++i) {
11752 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11753     for (int j = 0; j < 10; ++j)
11754       ;
11755   }
11756 #pragma omp parallel for simd
11757   for (int i = 0; i < 10; ++i) {
11758 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11759     for (int j = 0; j < 10; ++j)
11760       ;
11761   }
11762 #pragma omp parallel for simd
11763   for (int i = 0; i < 10; ++i) {
11764 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11765     for (int j = 0; j < 10; ++j)
11766       ;
11767   }
11768 #pragma omp parallel for simd
11769   for (int i = 0; i < 10; ++i) {
11770 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11771     a++;
11772   }
11773 #pragma omp parallel for simd
11774   for (int i = 0; i < 10; ++i) {
11775 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11776     for (int j = 0; j < 10; ++j)
11777       ;
11778   }
11779 #pragma omp parallel for simd
11780   for (int i = 0; i < 10; ++i) {
11781 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11782     for (int j = 0; j < 10; ++j)
11783       ;
11784   }
11785 #pragma omp parallel for simd
11786   for (int i = 0; i < 10; ++i) {
11787 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11788     for (int j = 0; j < 10; ++j)
11789       ;
11790   }
11791 #pragma omp parallel for simd
11792   for (int i = 0; i < 10; ++i) {
11793 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
11794     for (int j = 0; j < 10; ++j)
11795       ;
11796   }
11797 
11798 // PARALLEL SECTIONS DIRECTIVE
11799 #pragma omp parallel sections
11800   {
11801 #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?}}
11802     for (int i = 0; i < 10; ++i)
11803       ;
11804   }
11805 #pragma omp parallel sections
11806   {
11807 #pragma omp simd
11808     for (int i = 0; i < 10; ++i)
11809       ;
11810   }
11811 #pragma omp parallel sections
11812   {
11813 #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?}}
11814     for (int i = 0; i < 10; ++i)
11815       ;
11816   }
11817 #pragma omp parallel sections
11818   {
11819 #pragma omp parallel
11820     for (int i = 0; i < 10; ++i)
11821       ;
11822   }
11823 #pragma omp parallel sections
11824   {
11825 #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?}}
11826     {
11827       bar();
11828     }
11829   }
11830 #pragma omp parallel sections
11831   {
11832 #pragma omp section
11833     {
11834       bar();
11835     }
11836   }
11837 #pragma omp parallel sections
11838   {
11839 #pragma omp section
11840     {
11841 #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?}}
11842       bar();
11843 #pragma omp master // expected-error {{region cannot be closely nested inside 'section' region}}
11844       bar();
11845 #pragma omp critical
11846       bar();
11847     }
11848   }
11849 #pragma omp parallel sections
11850   {
11851 #pragma omp parallel
11852     {
11853 #pragma omp single // OK
11854       {
11855         bar();
11856       }
11857 #pragma omp master // OK
11858       {
11859         bar();
11860       }
11861 #pragma omp critical // OK
11862       {
11863         bar();
11864       }
11865 #pragma omp for // OK
11866       for (int i = 0; i < 10; ++i)
11867         ;
11868 #pragma omp for simd // OK
11869       for (int i = 0; i < 10; ++i)
11870         ;
11871 #pragma omp sections // OK
11872       {
11873         bar();
11874       }
11875     }
11876   }
11877 #pragma omp parallel sections
11878   {
11879 #pragma omp parallel for
11880     for (int i = 0; i < 10; ++i)
11881       ;
11882   }
11883 #pragma omp parallel sections
11884   {
11885 #pragma omp parallel for simd
11886     for (int i = 0; i < 10; ++i)
11887       ;
11888   }
11889 #pragma omp parallel sections
11890   {
11891 #pragma omp parallel sections
11892     {
11893       bar();
11894     }
11895   }
11896 #pragma omp parallel sections
11897   {
11898 #pragma omp task
11899     {
11900       bar();
11901     }
11902   }
11903 #pragma omp parallel sections
11904   {
11905 #pragma omp taskyield
11906   }
11907 #pragma omp parallel sections
11908   {
11909 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}}
11910   }
11911 #pragma omp parallel sections
11912   {
11913 #pragma omp taskwait
11914   }
11915 #pragma omp parallel sections
11916   {
11917 #pragma omp flush
11918   }
11919 #pragma omp parallel sections
11920   {
11921 #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?}}
11922     bar();
11923   }
11924 #pragma omp parallel sections
11925   {
11926 #pragma omp atomic
11927     ++a;
11928   }
11929 #pragma omp parallel sections
11930   {
11931 #pragma omp target
11932     ++a;
11933   }
11934 #pragma omp parallel sections
11935   {
11936 #pragma omp target parallel
11937     ++a;
11938   }
11939 #pragma omp parallel sections
11940   {
11941 #pragma omp target parallel for
11942     for (int i = 0; i < 10; ++i)
11943       ;
11944   }
11945 #pragma omp parallel sections
11946   {
11947 #pragma omp target enter data map(to: a)
11948   }
11949 #pragma omp parallel sections
11950   {
11951 #pragma omp target exit data map(from: a)
11952   }
11953 #pragma omp parallel sections
11954   {
11955 #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?}}
11956     ++a;
11957   }
11958 #pragma omp parallel sections
11959   {
11960 #pragma omp taskloop
11961   for (int i = 0; i < 10; ++i)
11962     ++a;
11963   }
11964 #pragma omp parallel sections
11965   {
11966 #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?}}
11967     for (int i = 0; i < 10; ++i)
11968       ;
11969   }
11970 #pragma omp parallel sections
11971   {
11972 #pragma omp target update to(a)
11973   }
11974 #pragma omp parallel sections
11975   {
11976 #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?}}
11977     for (int i = 0; i < 10; ++i)
11978       ;
11979   }
11980 #pragma omp parallel sections
11981   {
11982 #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?}}
11983     for (int i = 0; i < 10; ++i)
11984       ;
11985   }
11986 #pragma omp parallel sections
11987   {
11988 #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?}}
11989     for (int i = 0; i < 10; ++i)
11990       ;
11991   }
11992 #pragma omp parallel sections
11993   {
11994 #pragma omp target simd // OK
11995     for (int i = 0; i < 10; ++i)
11996       ;
11997   }
11998 #pragma omp parallel sections
11999   {
12000 #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?}}
12001     for (int i = 0; i < 10; ++i)
12002       ;
12003   }
12004 #pragma omp parallel sections
12005   {
12006 #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?}}
12007     for (int i = 0; i < 10; ++i)
12008       ;
12009   }
12010 #pragma omp parallel sections
12011   {
12012 #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?}}
12013     for (int i = 0; i < 10; ++i)
12014       ;
12015   }
12016 #pragma omp parallel sections
12017   {
12018 #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?}}
12019     for (int i = 0; i < 10; ++i)
12020       ;
12021   }
12022 #pragma omp parallel sections
12023   {
12024 #pragma omp target teams // OK
12025     a++;
12026   }
12027 #pragma omp parallel sections
12028   {
12029 #pragma omp target teams distribute // OK
12030     for (int i = 0; i < 10; ++i)
12031       ;
12032   }
12033 #pragma omp parallel sections
12034   {
12035 #pragma omp target teams distribute parallel for // OK
12036     for (int i = 0; i < 10; ++i)
12037       ;
12038   }
12039 #pragma omp parallel sections
12040   {
12041 #pragma omp target teams distribute parallel for simd // OK
12042     for (int i = 0; i < 10; ++i)
12043       ;
12044   }
12045 #pragma omp parallel sections
12046   {
12047 #pragma omp target teams distribute simd // OK
12048     for (int i = 0; i < 10; ++i)
12049       ;
12050   }
12051 
12052 // TASK DIRECTIVE
12053 #pragma omp task
12054 #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?}}
12055   for (int i = 0; i < 10; ++i)
12056     ;
12057 #pragma omp task
12058 #pragma omp simd
12059   for (int i = 0; i < 10; ++i)
12060     ;
12061 #pragma omp task
12062 #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?}}
12063   for (int i = 0; i < 10; ++i)
12064     ;
12065 #pragma omp task
12066 #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?}}
12067   {
12068     bar();
12069   }
12070 #pragma omp task
12071 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a task region}}
12072   {
12073     bar();
12074   }
12075 #pragma omp task
12076 #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?}}
12077   bar();
12078 #pragma omp task
12079 #pragma omp master // expected-error {{region cannot be closely nested inside 'task' region}}
12080   bar();
12081 #pragma omp task
12082 #pragma omp critical
12083   bar();
12084 #pragma omp task
12085 #pragma omp parallel for
12086   for (int i = 0; i < 10; ++i)
12087     ;
12088 #pragma omp task
12089 #pragma omp parallel for simd
12090   for (int i = 0; i < 10; ++i)
12091     ;
12092 #pragma omp task
12093 #pragma omp parallel sections
12094   {
12095     bar();
12096   }
12097 #pragma omp task
12098 #pragma omp task
12099   {
12100     bar();
12101   }
12102 #pragma omp task
12103   {
12104 #pragma omp taskyield
12105     bar();
12106   }
12107 #pragma omp task
12108   {
12109 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}}
12110     bar();
12111   }
12112 #pragma omp task
12113   {
12114 #pragma omp taskwait
12115     bar();
12116   }
12117 #pragma omp task
12118   {
12119 #pragma omp flush
12120     bar();
12121   }
12122 #pragma omp task
12123   {
12124 #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?}}
12125     bar();
12126   }
12127 #pragma omp task
12128   {
12129 #pragma omp atomic
12130     ++a;
12131   }
12132 #pragma omp task
12133   {
12134 #pragma omp target
12135     ++a;
12136   }
12137 #pragma omp task
12138   {
12139 #pragma omp target parallel
12140     ++a;
12141   }
12142 #pragma omp task
12143 #pragma omp target parallel for
12144   for (int i = 0; i < 10; ++i)
12145     ;
12146 #pragma omp task
12147   {
12148 #pragma omp target enter data map(to: a)
12149     ++a;
12150   }
12151 #pragma omp task
12152   {
12153 #pragma omp target exit data map(from: a)
12154     ++a;
12155   }
12156 #pragma omp task
12157   {
12158 #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?}}
12159     ++a;
12160   }
12161 #pragma omp task
12162   {
12163 #pragma omp taskloop
12164   for (int i = 0; i < 10; ++i)
12165     ++a;
12166   }
12167 #pragma omp task
12168   {
12169 #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?}}
12170     for (int i = 0; i < 10; ++i)
12171       ;
12172   }
12173 #pragma omp task
12174   {
12175 #pragma omp target update to(a)
12176     a++;
12177   }
12178 #pragma omp task
12179   {
12180 #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?}}
12181     for (int i = 0; i < 10; ++i)
12182       ;
12183   }
12184 #pragma omp task
12185   {
12186 #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?}}
12187     for (int i = 0; i < 10; ++i)
12188       ;
12189   }
12190 #pragma omp task
12191   {
12192 #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?}}
12193     for (int i = 0; i < 10; ++i)
12194       ;
12195   }
12196 #pragma omp task
12197   {
12198 #pragma omp target simd // OK
12199     for (int i = 0; i < 10; ++i)
12200       ;
12201   }
12202 #pragma omp task
12203   {
12204 #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?}}
12205     for (int i = 0; i < 10; ++i)
12206       ;
12207   }
12208 #pragma omp task
12209   {
12210 #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?}}
12211     for (int i = 0; i < 10; ++i)
12212       ;
12213   }
12214 #pragma omp task
12215   {
12216 #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?}}
12217     for (int i = 0; i < 10; ++i)
12218       ;
12219   }
12220 #pragma omp task
12221   {
12222 #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?}}
12223     for (int i = 0; i < 10; ++i)
12224       ;
12225   }
12226 #pragma omp task
12227   {
12228 #pragma omp target teams // OK
12229     a++;
12230   }
12231 #pragma omp task
12232   {
12233 #pragma omp target teams distribute // OK
12234     for (int i = 0; i < 10; ++i)
12235       ;
12236   }
12237 #pragma omp task
12238   {
12239 #pragma omp target teams distribute parallel for // OK
12240     for (int i = 0; i < 10; ++i)
12241       ;
12242   }
12243 #pragma omp task
12244   {
12245 #pragma omp target teams distribute parallel for simd // OK
12246     for (int i = 0; i < 10; ++i)
12247       ;
12248   }
12249 #pragma omp task
12250   {
12251 #pragma omp target teams distribute simd // OK
12252     for (int i = 0; i < 10; ++i)
12253       ;
12254   }
12255 
12256 // ATOMIC DIRECTIVE
12257 #pragma omp atomic
12258   // 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}}
12259   // expected-note@+1 {{expected an expression statement}}
12260   {
12261 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12262     for (int i = 0; i < 10; ++i)
12263       ;
12264   }
12265 #pragma omp atomic
12266   // 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}}
12267   // expected-note@+1 {{expected an expression statement}}
12268   {
12269 #pragma omp simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12270     for (int i = 0; i < 10; ++i)
12271       ;
12272   }
12273 #pragma omp atomic
12274   // 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}}
12275   // expected-note@+1 {{expected an expression statement}}
12276   {
12277 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12278     for (int i = 0; i < 10; ++i)
12279       ;
12280   }
12281 #pragma omp atomic
12282   // 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}}
12283   // expected-note@+1 {{expected an expression statement}}
12284   {
12285 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12286     for (int i = 0; i < 10; ++i)
12287       ;
12288   }
12289 #pragma omp atomic
12290   // 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}}
12291   // expected-note@+1 {{expected an expression statement}}
12292   {
12293 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12294     {
12295       bar();
12296     }
12297   }
12298 #pragma omp atomic
12299   // 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}}
12300   // expected-note@+1 {{expected an expression statement}}
12301   {
12302 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12303     {
12304       bar();
12305     }
12306   }
12307 #pragma omp atomic
12308   // 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}}
12309   // expected-note@+1 {{expected an expression statement}}
12310   {
12311 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12312     {
12313       bar();
12314     }
12315   }
12316 #pragma omp atomic
12317   // 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}}
12318   // expected-note@+1 {{expected an expression statement}}
12319   {
12320 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12321     {
12322       bar();
12323     }
12324   }
12325 #pragma omp atomic
12326   // 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}}
12327   // expected-note@+1 {{expected an expression statement}}
12328   {
12329 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12330     {
12331       bar();
12332     }
12333   }
12334 #pragma omp atomic
12335   // 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}}
12336   // expected-note@+1 {{expected an expression statement}}
12337   {
12338 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12339     for (int i = 0; i < 10; ++i)
12340       ;
12341   }
12342 #pragma omp atomic
12343   // 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}}
12344   // expected-note@+1 {{expected an expression statement}}
12345   {
12346 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12347     for (int i = 0; i < 10; ++i)
12348       ;
12349   }
12350 #pragma omp atomic
12351   // 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}}
12352   // expected-note@+1 {{expected an expression statement}}
12353   {
12354 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12355     {
12356       bar();
12357     }
12358   }
12359 #pragma omp atomic
12360   // 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}}
12361   // expected-note@+1 {{expected an expression statement}}
12362   {
12363 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12364     {
12365       bar();
12366     }
12367   }
12368 #pragma omp atomic
12369   // 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}}
12370   // expected-note@+1 {{expected an expression statement}}
12371   {
12372 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12373     bar();
12374   }
12375 #pragma omp atomic
12376   // 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}}
12377   // expected-note@+1 {{expected an expression statement}}
12378   {
12379 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12380     bar();
12381   }
12382 #pragma omp atomic
12383   // 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}}
12384   // expected-note@+1 {{expected an expression statement}}
12385   {
12386 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12387     bar();
12388   }
12389 #pragma omp atomic
12390   // 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}}
12391   // expected-note@+1 {{expected an expression statement}}
12392   {
12393 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12394     bar();
12395   }
12396 #pragma omp atomic
12397   // 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}}
12398   // expected-note@+1 {{expected an expression statement}}
12399   {
12400 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12401     bar();
12402   }
12403 #pragma omp atomic
12404   // 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}}
12405   // expected-note@+1 {{expected an expression statement}}
12406   {
12407 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12408     ++a;
12409   }
12410 #pragma omp atomic
12411   // 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}}
12412   // expected-note@+1 {{expected an expression statement}}
12413   {
12414 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12415     ++a;
12416   }
12417 #pragma omp atomic
12418   // 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}}
12419   // expected-note@+1 {{expected an expression statement}}
12420   {
12421 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12422     ++a;
12423   }
12424 #pragma omp atomic
12425   // 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}}
12426   // expected-note@+1 {{expected an expression statement}}
12427   {
12428 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12429     for (int i = 0; i < 10; ++i)
12430       ;
12431   }
12432 #pragma omp atomic
12433   // 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}}
12434   // expected-note@+1 {{expected an expression statement}}
12435   {
12436 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12437     ++a;
12438   }
12439 #pragma omp atomic
12440   // 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}}
12441   // expected-note@+1 {{expected an expression statement}}
12442   {
12443 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12444     ++a;
12445   }
12446 #pragma omp atomic
12447   // 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}}
12448   // expected-note@+1 {{expected an expression statement}}
12449   {
12450 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12451     ++a;
12452   }
12453 #pragma omp atomic
12454   // 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}}
12455   // expected-note@+1 {{expected an expression statement}}
12456   {
12457 #pragma omp taskloop // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12458   for (int i = 0; i < 10; ++i)
12459     ++a;
12460   }
12461 #pragma omp atomic
12462   // 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}}
12463   // expected-note@+1 {{expected an expression statement}}
12464   {
12465 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12466     for (int i = 0; i < 10; ++i)
12467       ;
12468   }
12469 #pragma omp atomic
12470   // 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}}
12471   // expected-note@+1 {{expected an expression statement}}
12472   {
12473 #pragma omp target update // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12474   }
12475 #pragma omp atomic
12476   // 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}}
12477   // expected-note@+1 {{expected an expression statement}}
12478   {
12479 #pragma omp distribute parallel for// expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12480     for (int i = 0; i < 10; ++i)
12481       ;
12482   }
12483 #pragma omp atomic
12484   // 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}}
12485   // expected-note@+1 {{expected an expression statement}}
12486   {
12487 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12488     for (int i = 0; i < 10; ++i)
12489       ;
12490   }
12491 #pragma omp atomic
12492   // 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}}
12493   // expected-note@+1 {{expected an expression statement}}
12494   {
12495 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12496     for (int i = 0; i < 10; ++i)
12497       ;
12498   }
12499 #pragma omp atomic
12500   // 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}}
12501   // expected-note@+1 {{expected an expression statement}}
12502   {
12503 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12504     for (int i = 0; i < 10; ++i)
12505       ;
12506   }
12507 #pragma omp atomic
12508   // 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}}
12509   // expected-note@+1 {{expected an expression statement}}
12510   {
12511 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12512     for (int i = 0; i < 10; ++i)
12513       ;
12514   }
12515 #pragma omp atomic
12516   // 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}}
12517   // expected-note@+1 {{expected an expression statement}}
12518   {
12519 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12520     for (int i = 0; i < 10; ++i)
12521       ;
12522   }
12523 #pragma omp atomic
12524   // 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}}
12525   // expected-note@+1 {{expected an expression statement}}
12526   {
12527 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12528     for (int i = 0; i < 10; ++i)
12529       ;
12530   }
12531 #pragma omp atomic
12532   // 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}}
12533   // expected-note@+1 {{expected an expression statement}}
12534   {
12535 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12536     for (int i = 0; i < 10; ++i)
12537       ;
12538   }
12539 #pragma omp atomic
12540   // 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}}
12541   // expected-note@+1 {{expected an expression statement}}
12542   {
12543 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12544     a++;
12545   }
12546 #pragma omp atomic
12547   // 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}}
12548   // expected-note@+1 {{expected an expression statement}}
12549   {
12550 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12551     for (int i = 0; i < 10; ++i)
12552       ;
12553   }
12554 #pragma omp atomic
12555   // 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}}
12556   // expected-note@+1 {{expected an expression statement}}
12557   {
12558 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12559     for (int i = 0; i < 10; ++i)
12560       ;
12561   }
12562 #pragma omp atomic
12563   // 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}}
12564   // expected-note@+1 {{expected an expression statement}}
12565   {
12566 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12567     for (int i = 0; i < 10; ++i)
12568       ;
12569   }
12570 #pragma omp atomic
12571   // 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}}
12572   // expected-note@+1 {{expected an expression statement}}
12573   {
12574 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12575     for (int i = 0; i < 10; ++i)
12576       ;
12577   }
12578 
12579 // TARGET DIRECTIVE
12580 #pragma omp target
12581 #pragma omp parallel
12582   bar();
12583 #pragma omp target
12584 #pragma omp for
12585   for (int i = 0; i < 10; ++i)
12586     ;
12587 #pragma omp target
12588 #pragma omp simd
12589   for (int i = 0; i < 10; ++i)
12590     ;
12591 #pragma omp target
12592 #pragma omp for simd
12593   for (int i = 0; i < 10; ++i)
12594     ;
12595 #pragma omp target
12596 #pragma omp sections
12597   {
12598     bar();
12599   }
12600 #pragma omp target
12601 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target region}}
12602   {
12603     bar();
12604   }
12605 #pragma omp target
12606 #pragma omp single
12607   bar();
12608 
12609 #pragma omp target
12610 #pragma omp master
12611   {
12612     bar();
12613   }
12614 #pragma omp target
12615 #pragma omp critical
12616   {
12617     bar();
12618   }
12619 #pragma omp target
12620 #pragma omp parallel for
12621   for (int i = 0; i < 10; ++i)
12622     ;
12623 #pragma omp target
12624 #pragma omp parallel for simd
12625   for (int i = 0; i < 10; ++i)
12626     ;
12627 #pragma omp target
12628 #pragma omp parallel sections
12629   {
12630     bar();
12631   }
12632 #pragma omp target
12633 #pragma omp task
12634   {
12635     bar();
12636   }
12637 #pragma omp target
12638   {
12639 #pragma omp taskyield
12640     bar();
12641   }
12642 #pragma omp target
12643   {
12644 #pragma omp barrier
12645     bar();
12646   }
12647 #pragma omp target
12648   {
12649 #pragma omp taskwait
12650     bar();
12651   }
12652 #pragma omp target
12653   {
12654 #pragma omp flush
12655     bar();
12656   }
12657 #pragma omp target
12658   {
12659 #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?}}
12660     bar();
12661   }
12662 #pragma omp target
12663   {
12664 #pragma omp atomic
12665     ++a;
12666   }
12667 #pragma omp target
12668   {
12669 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
12670     ++a;
12671   }
12672 #pragma omp target
12673   {
12674 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
12675     ++a;
12676   }
12677 #pragma omp target
12678 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
12679   for (int i = 0; i < 10; ++i)
12680     ;
12681 #pragma omp target
12682   {
12683 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
12684   }
12685 #pragma omp target
12686   {
12687 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
12688   }
12689 #pragma omp target
12690   {
12691 #pragma omp teams
12692     ++a;
12693   }
12694 #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
12695   {
12696     ++a;          // expected-note {{statement outside teams construct here}}
12697 #pragma omp teams // expected-note {{nested teams construct here}}
12698     ++a;
12699   }
12700 #pragma omp target
12701   {
12702 #pragma omp taskloop
12703   for (int i = 0; i < 10; ++i)
12704     ++a;
12705   }
12706 #pragma omp target
12707   {
12708 #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?}}
12709     for (int i = 0; i < 10; ++i)
12710       ;
12711   }
12712 #pragma omp atomic
12713   // 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}}
12714   // expected-note@+1 {{expected an expression statement}}
12715   {
12716 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
12717     a++;
12718   }
12719 #pragma omp target
12720   {
12721 #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?}}
12722     for (int i = 0; i < 10; ++i)
12723       ;
12724   }
12725 #pragma omp target
12726   {
12727 #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?}}
12728     for (int i = 0; i < 10; ++i)
12729       ;
12730   }
12731 #pragma omp target
12732   {
12733 #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?}}
12734     for (int i = 0; i < 10; ++i)
12735       ;
12736   }
12737 #pragma omp target
12738   {
12739 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
12740     for (int i = 0; i < 10; ++i)
12741       ;
12742   }
12743 #pragma omp target
12744   {
12745 #pragma omp teams distribute // OK
12746     for (int i = 0; i < 10; ++i)
12747       ;
12748   }
12749 #pragma omp target
12750   {
12751 #pragma omp teams distribute simd // OK
12752     for (int i = 0; i < 10; ++i)
12753       ;
12754   }
12755 #pragma omp target
12756   {
12757 #pragma omp teams distribute parallel for simd // OK
12758     for (int i = 0; i < 10; ++i)
12759       ;
12760   }
12761 #pragma omp target
12762   {
12763 #pragma omp teams distribute parallel for // OK
12764     for (int i = 0; i < 10; ++i)
12765       ;
12766   }
12767 #pragma omp target
12768   {
12769 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
12770     a++;
12771   }
12772 #pragma omp target
12773   {
12774 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
12775     for (int i = 0; i < 10; ++i)
12776       ;
12777   }
12778 #pragma omp target
12779   {
12780 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
12781     for (int i = 0; i < 10; ++i)
12782       ;
12783   }
12784 #pragma omp target
12785   {
12786 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
12787     for (int i = 0; i < 10; ++i)
12788       ;
12789   }
12790 #pragma omp target
12791   {
12792 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
12793     for (int i = 0; i < 10; ++i)
12794       ;
12795   }
12796 
12797 // TARGET PARALLEL DIRECTIVE
12798 #pragma omp target parallel
12799 #pragma omp parallel
12800   bar();
12801 #pragma omp target parallel
12802 #pragma omp for
12803   for (int i = 0; i < 10; ++i)
12804     ;
12805 #pragma omp target parallel
12806 #pragma omp simd
12807   for (int i = 0; i < 10; ++i)
12808     ;
12809 #pragma omp target parallel
12810 #pragma omp for simd
12811   for (int i = 0; i < 10; ++i)
12812     ;
12813 #pragma omp target parallel
12814 #pragma omp sections
12815   {
12816     bar();
12817   }
12818 #pragma omp target parallel
12819 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel region}}
12820   {
12821     bar();
12822   }
12823 #pragma omp target parallel
12824 #pragma omp single
12825   bar();
12826 
12827 #pragma omp target parallel
12828 #pragma omp master
12829   {
12830     bar();
12831   }
12832 #pragma omp target parallel
12833 #pragma omp critical
12834   {
12835     bar();
12836   }
12837 #pragma omp target parallel
12838 #pragma omp parallel for
12839   for (int i = 0; i < 10; ++i)
12840     ;
12841 #pragma omp target parallel
12842 #pragma omp parallel for simd
12843   for (int i = 0; i < 10; ++i)
12844     ;
12845 #pragma omp target parallel
12846 #pragma omp parallel sections
12847   {
12848     bar();
12849   }
12850 #pragma omp target parallel
12851 #pragma omp task
12852   {
12853     bar();
12854   }
12855 #pragma omp target parallel
12856   {
12857 #pragma omp taskyield
12858     bar();
12859   }
12860 #pragma omp target parallel
12861   {
12862 #pragma omp barrier
12863     bar();
12864   }
12865 #pragma omp target parallel
12866   {
12867 #pragma omp taskwait
12868     bar();
12869   }
12870 #pragma omp target parallel
12871   {
12872 #pragma omp flush
12873     bar();
12874   }
12875 #pragma omp target parallel
12876   {
12877 #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?}}
12878     bar();
12879   }
12880 #pragma omp target parallel
12881   {
12882 #pragma omp atomic
12883     ++a;
12884   }
12885 #pragma omp target parallel
12886   {
12887 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel' region}}
12888     ++a;
12889   }
12890 #pragma omp target parallel
12891   {
12892 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel' region}}
12893     ++a;
12894   }
12895 #pragma omp target parallel
12896 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel' region}}
12897   for (int i = 0; i < 10; ++i)
12898     ;
12899 #pragma omp target parallel
12900   {
12901 #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?}}
12902     ++a;
12903   }
12904 #pragma omp target parallel
12905   {
12906     ++a;
12907 #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?}}
12908     ++a;
12909   }
12910 #pragma omp target parallel
12911   {
12912 #pragma omp taskloop
12913   for (int i = 0; i < 10; ++i)
12914     ++a;
12915   }
12916 #pragma omp target parallel
12917   {
12918 #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?}}
12919     for (int i = 0; i < 10; ++i)
12920       ;
12921   }
12922 #pragma omp target parallel
12923   {
12924 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel' region}}
12925   }
12926 #pragma omp target parallel
12927   {
12928 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel' region}}
12929   }
12930 #pragma omp target parallel
12931   {
12932 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel' region}}
12933   }
12934 #pragma omp target parallel
12935   {
12936 #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?}}
12937     for (int i = 0; i < 10; ++i)
12938       ;
12939   }
12940 #pragma omp target parallel
12941   {
12942 #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?}}
12943     for (int i = 0; i < 10; ++i)
12944       ;
12945   }
12946 #pragma omp target parallel
12947   {
12948 #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?}}
12949     for (int i = 0; i < 10; ++i)
12950       ;
12951   }
12952 #pragma omp target parallel
12953   {
12954 #pragma omp target simd // expected-error {{region cannot be nested inside 'target parallel' regio}}
12955     for (int i = 0; i < 10; ++i)
12956       ;
12957   }
12958 #pragma omp target parallel
12959   {
12960 #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?}}
12961     for (int i = 0; i < 10; ++i)
12962       ;
12963   }
12964 #pragma omp target parallel
12965   {
12966 #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?}}
12967     for (int i = 0; i < 10; ++i)
12968       ;
12969   }
12970 #pragma omp target parallel
12971   {
12972 #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?}}
12973     for (int i = 0; i < 10; ++i)
12974       ;
12975   }
12976 #pragma omp target parallel
12977   {
12978 #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?}}
12979     for (int i = 0; i < 10; ++i)
12980       ;
12981   }
12982 #pragma omp target parallel
12983   {
12984 #pragma omp target teams // expected-error {{region cannot be nested inside 'target parallel' region}}
12985     a++;
12986   }
12987 #pragma omp target parallel
12988   {
12989 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target parallel' region}}
12990     for (int i = 0; i < 10; ++i)
12991       ;
12992   }
12993 #pragma omp target parallel
12994   {
12995 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target parallel' region}}
12996     for (int i = 0; i < 10; ++i)
12997       ;
12998   }
12999 #pragma omp target parallel
13000   {
13001 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target parallel' region}}
13002     for (int i = 0; i < 10; ++i)
13003       ;
13004   }
13005 #pragma omp target parallel
13006   {
13007 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target parallel' region}}
13008     for (int i = 0; i < 10; ++i)
13009       ;
13010   }
13011 
13012 // TARGET PARALLEL FOR DIRECTIVE
13013 #pragma omp target parallel for
13014   for (int i = 0; i < 10; ++i) {
13015 #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?}}
13016     for (int i = 0; i < 10; ++i)
13017       ;
13018   }
13019 #pragma omp target parallel for
13020   for (int i = 0; i < 10; ++i) {
13021 #pragma omp simd
13022     for (int i = 0; i < 10; ++i)
13023       ;
13024   }
13025 #pragma omp target parallel for
13026   for (int i = 0; i < 10; ++i) {
13027 #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?}}
13028     for (int i = 0; i < 10; ++i)
13029       ;
13030   }
13031 #pragma omp target parallel for
13032   for (int i = 0; i < 10; ++i) {
13033 #pragma omp parallel
13034     for (int i = 0; i < 10; ++i)
13035       ;
13036   }
13037 #pragma omp target parallel for
13038   for (int i = 0; i < 10; ++i) {
13039 #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?}}
13040     {
13041       bar();
13042     }
13043   }
13044 #pragma omp target parallel for
13045   for (int i = 0; i < 10; ++i) {
13046 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target parallel for region}}
13047     {
13048       bar();
13049     }
13050   }
13051 #pragma omp target parallel for
13052   for (int i = 0; i < 10; ++i) {
13053 #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?}}
13054     {
13055       bar();
13056     }
13057   }
13058 
13059 #pragma omp target parallel for
13060   for (int i = 0; i < 10; ++i) {
13061 #pragma omp master // expected-error {{region cannot be closely nested inside 'target parallel for' region}}
13062     {
13063       bar();
13064     }
13065   }
13066 
13067 #pragma omp target parallel for
13068   for (int i = 0; i < 10; ++i) {
13069 #pragma omp critical
13070     {
13071       bar();
13072     }
13073   }
13074 
13075 #pragma omp target parallel for
13076   for (int i = 0; i < 10; ++i) {
13077 #pragma omp parallel
13078     {
13079 #pragma omp single // OK
13080       {
13081         bar();
13082       }
13083 #pragma omp for // OK
13084       for (int i = 0; i < 10; ++i)
13085         ;
13086 #pragma omp for simd // OK
13087       for (int i = 0; i < 10; ++i)
13088         ;
13089 #pragma omp sections // OK
13090       {
13091         bar();
13092       }
13093     }
13094   }
13095 #pragma omp target parallel for
13096   for (int i = 0; i < 10; ++i) {
13097 #pragma omp parallel for
13098     for (int i = 0; i < 10; ++i)
13099       ;
13100   }
13101 #pragma omp target parallel for
13102   for (int i = 0; i < 10; ++i) {
13103 #pragma omp parallel for simd
13104     for (int i = 0; i < 10; ++i)
13105       ;
13106   }
13107 #pragma omp target parallel for
13108   for (int i = 0; i < 10; ++i) {
13109 #pragma omp parallel sections
13110     {
13111       bar();
13112     }
13113   }
13114 #pragma omp target parallel for
13115   for (int i = 0; i < 10; ++i) {
13116 #pragma omp task
13117     {
13118       bar();
13119     }
13120   }
13121 #pragma omp target parallel for
13122   for (int i = 0; i < 10; ++i) {
13123 #pragma omp taskyield
13124     bar();
13125   }
13126 #pragma omp target parallel for
13127   for (int i = 0; i < 10; ++i) {
13128 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target parallel for' region}}
13129     bar();
13130   }
13131 #pragma omp target parallel for
13132   for (int i = 0; i < 10; ++i) {
13133 #pragma omp taskwait
13134     bar();
13135   }
13136 #pragma omp target parallel for
13137   for (int i = 0; i < 10; ++i) {
13138 #pragma omp flush
13139     bar();
13140   }
13141 #pragma omp target parallel for
13142   for (int i = 0; i < 10; ++i) {
13143 #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?}}
13144     bar();
13145   }
13146 #pragma omp target parallel for ordered
13147   for (int i = 0; i < 10; ++i) {
13148 #pragma omp ordered // OK
13149     bar();
13150   }
13151 #pragma omp target parallel for
13152   for (int i = 0; i < 10; ++i) {
13153 #pragma omp atomic
13154     ++a;
13155   }
13156 #pragma omp target parallel for
13157   for (int i = 0; i < 10; ++i) {
13158 #pragma omp target // expected-error {{region cannot be nested inside 'target parallel for' region}}
13159     ++a;
13160   }
13161 #pragma omp target parallel for
13162   for (int i = 0; i < 10; ++i) {
13163 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target parallel for' region}}
13164     ++a;
13165   }
13166 #pragma omp target parallel for
13167   for (int i = 0; i < 10; ++i) {
13168 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}}
13169     for (int i = 0; i < 10; ++i)
13170       ;
13171   }
13172 #pragma omp target parallel for
13173   for (int i = 0; i < 10; ++i) {
13174 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
13175     ++a;
13176   }
13177 #pragma omp target parallel for
13178   for (int i = 0; i < 10; ++i) {
13179 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
13180     ++a;
13181   }
13182 #pragma omp target parallel for
13183   for (int i = 0; i < 10; ++i) {
13184 #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?}}
13185     ++a;
13186   }
13187 #pragma omp target parallel for
13188   for (int i = 0; i < 10; ++i) {
13189 #pragma omp taskloop
13190   for (int i = 0; i < 10; ++i)
13191     ++a;
13192   }
13193 #pragma omp target parallel for
13194   for (int i = 0; i < 10; ++i) {
13195 #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?}}
13196     for (int j = 0; j < 10; ++j)
13197       ;
13198   }
13199 #pragma omp target parallel for
13200   for (int i = 0; i < 10; ++i) {
13201 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target parallel for' region}}
13202     a++;
13203   }
13204 #pragma omp target parallel for
13205   for (int i = 0; i < 10; ++i) {
13206 #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?}}
13207     for (int j = 0; j < 10; ++j)
13208       ;
13209   }
13210 #pragma omp target parallel for
13211   for (int i = 0; i < 10; ++i) {
13212 #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?}}
13213     for (int j = 0; j < 10; ++j)
13214       ;
13215   }
13216 #pragma omp target parallel for
13217   for (int i = 0; i < 10; ++i) {
13218 #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?}}
13219     for (int j = 0; j < 10; ++j)
13220       ;
13221   }
13222 #pragma omp target parallel for
13223   for (int i = 0; i < 10; ++i) {
13224 #pragma omp target simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
13225     for (int j = 0; j < 10; ++j)
13226       ;
13227   }
13228 #pragma omp target parallel for
13229   for (int i = 0; i < 10; ++i) {
13230 #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?}}
13231     for (int j = 0; j < 10; ++j)
13232       ;
13233   }
13234 #pragma omp target parallel for
13235   for (int i = 0; i < 10; ++i) {
13236 #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?}}
13237     for (int j = 0; j < 10; ++j)
13238       ;
13239   }
13240 #pragma omp target parallel for
13241   for (int i = 0; i < 10; ++i) {
13242 #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?}}
13243     for (int j = 0; j < 10; ++j)
13244       ;
13245   }
13246 #pragma omp target parallel for
13247   for (int i = 0; i < 10; ++i) {
13248 #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?}}
13249     for (int j = 0; j < 10; ++j)
13250       ;
13251   }
13252 #pragma omp target parallel for
13253   for (int i = 0; i < 10; ++i) {
13254 #pragma omp target teams // expected-error {{region cannot be nested inside 'target parallel for' region}}
13255     a++;
13256   }
13257 #pragma omp target parallel for
13258   for (int i = 0; i < 10; ++i) {
13259 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target parallel for' region}}
13260     for (int j = 0; j < 10; ++j)
13261       ;
13262   }
13263 #pragma omp target parallel for
13264   for (int i = 0; i < 10; ++i) {
13265 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target parallel for' region}}
13266     for (int j = 0; j < 10; ++j)
13267       ;
13268   }
13269 #pragma omp target parallel for
13270   for (int i = 0; i < 10; ++i) {
13271 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
13272     for (int j = 0; j < 10; ++j)
13273       ;
13274   }
13275 #pragma omp target parallel for
13276   for (int i = 0; i < 10; ++i) {
13277 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target parallel for' region}}
13278     for (int j = 0; j < 10; ++j)
13279       ;
13280   }
13281 
13282 // TEAMS DIRECTIVE
13283 #pragma omp target
13284 #pragma omp teams
13285 #pragma omp parallel
13286   bar();
13287 #pragma omp target
13288 #pragma omp teams
13289 #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?}}
13290   for (int i = 0; i < 10; ++i)
13291     ;
13292 #pragma omp target
13293 #pragma omp teams
13294 #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?}}
13295   for (int i = 0; i < 10; ++i)
13296     ;
13297 #pragma omp target
13298 #pragma omp teams
13299 #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?}}
13300   for (int i = 0; i < 10; ++i)
13301     ;
13302 #pragma omp target
13303 #pragma omp teams
13304 #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?}}
13305   {
13306     bar();
13307   }
13308 #pragma omp target
13309 #pragma omp teams
13310 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams region}}
13311   {
13312     bar();
13313   }
13314 #pragma omp target
13315 #pragma omp teams
13316 #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?}}
13317   bar();
13318 
13319 #pragma omp target
13320 #pragma omp teams
13321 #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?}}
13322   {
13323     bar();
13324   }
13325 #pragma omp target
13326 #pragma omp teams
13327 #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?}}
13328   {
13329     bar();
13330   }
13331 #pragma omp target
13332 #pragma omp teams
13333 #pragma omp parallel for
13334   for (int i = 0; i < 10; ++i)
13335     ;
13336 #pragma omp target
13337 #pragma omp teams
13338 #pragma omp parallel for simd
13339   for (int i = 0; i < 10; ++i)
13340     ;
13341 #pragma omp target
13342 #pragma omp teams
13343 #pragma omp parallel sections
13344   {
13345     bar();
13346   }
13347 #pragma omp target
13348 #pragma omp teams
13349 #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?}}
13350   {
13351     bar();
13352   }
13353 #pragma omp target
13354 #pragma omp teams
13355   {
13356 #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?}}
13357     bar();
13358   }
13359 #pragma omp target
13360 #pragma omp teams
13361   {
13362 #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?}}
13363     bar();
13364   }
13365 #pragma omp target
13366 #pragma omp teams
13367   {
13368 #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?}}
13369     bar();
13370   }
13371 #pragma omp target
13372 #pragma omp teams
13373   {
13374 #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?}}
13375     bar();
13376   }
13377 #pragma omp target
13378 #pragma omp teams
13379   {
13380 #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?}}
13381     bar();
13382   }
13383 #pragma omp target
13384 #pragma omp teams
13385   {
13386 #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?}}
13387     ++a;
13388   }
13389 #pragma omp target
13390 #pragma omp teams
13391   {
13392 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
13393     ++a;
13394   }
13395 #pragma omp target
13396 #pragma omp teams
13397   {
13398 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
13399     ++a;
13400   }
13401 #pragma omp target
13402 #pragma omp teams
13403 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
13404   for (int i = 0; i < 10; ++i)
13405     ;
13406 #pragma omp target
13407 #pragma omp teams
13408   {
13409 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
13410   }
13411 #pragma omp target
13412 #pragma omp teams
13413   {
13414 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
13415   }
13416 #pragma omp target
13417 #pragma omp teams
13418   {
13419 #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?}}
13420     ++a;
13421   }
13422 #pragma omp target
13423 #pragma omp teams
13424   {
13425 #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?}}
13426   for (int i = 0; i < 10; ++i)
13427     ++a;
13428   }
13429 #pragma omp target
13430 #pragma omp teams
13431 #pragma omp distribute
13432   for (int i = 0; i < 10; ++i)
13433     ;
13434 #pragma omp target
13435 #pragma omp teams
13436 #pragma omp distribute
13437   for (int i = 0; i < 10; ++i)
13438     ;
13439 #pragma omp distribute
13440   for (int j = 0; j < 10; ++j)
13441     ;
13442 #pragma omp target
13443 #pragma omp teams
13444   {
13445 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
13446     ++a;
13447   }
13448 #pragma omp target
13449 #pragma omp teams
13450 #pragma omp distribute parallel for
13451   for (int i = 0; i < 10; ++i)
13452     ;
13453 #pragma omp target
13454 #pragma omp teams
13455   {
13456 #pragma omp distribute parallel for
13457   for (int i = 0; i < 10; ++i)
13458     ;
13459 #pragma omp distribute parallel for
13460   for (int j = 0; j < 10; ++j)
13461     ;
13462   }
13463 #pragma omp target
13464 #pragma omp teams
13465   {
13466 #pragma omp distribute parallel for simd
13467   for (int i = 0; i < 10; ++i)
13468     ;
13469 #pragma omp distribute parallel for simd
13470   for (int j = 0; j < 10; ++j)
13471     ;
13472   }
13473 #pragma omp target
13474 #pragma omp teams
13475   {
13476 #pragma omp distribute simd
13477   for (int i = 0; i < 10; ++i)
13478     ;
13479 #pragma omp distribute simd
13480   for (int j = 0; j < 10; ++j)
13481     ;
13482   }
13483 #pragma omp target
13484 #pragma omp teams
13485   {
13486 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
13487   for (int i = 0; i < 10; ++i)
13488     ;
13489   }
13490 #pragma omp target
13491 #pragma omp teams
13492   {
13493 #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?}}
13494   for (int i = 0; i < 10; ++i)
13495     ;
13496   }
13497 #pragma omp target
13498 #pragma omp teams
13499   {
13500 #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?}}
13501   for (int i = 0; i < 10; ++i)
13502     ;
13503   }
13504 #pragma omp target
13505 #pragma omp teams
13506   {
13507 #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?}}
13508   for (int i = 0; i < 10; ++i)
13509     ;
13510   }
13511 #pragma omp target
13512 #pragma omp teams
13513   {
13514 #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?}}
13515   for (int i = 0; i < 10; ++i)
13516     ;
13517   }
13518 #pragma omp target
13519 #pragma omp teams
13520   {
13521 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
13522     a++;
13523   }
13524 #pragma omp target
13525 #pragma omp teams
13526   {
13527 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
13528   for (int i = 0; i < 10; ++i)
13529     ;
13530   }
13531 #pragma omp target
13532 #pragma omp teams
13533   {
13534 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
13535   for (int i = 0; i < 10; ++i)
13536     ;
13537   }
13538 #pragma omp target
13539 #pragma omp teams
13540   {
13541 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
13542   for (int i = 0; i < 10; ++i)
13543     ;
13544   }
13545 #pragma omp target
13546 #pragma omp teams
13547   {
13548 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
13549   for (int i = 0; i < 10; ++i)
13550     ;
13551   }
13552 
13553 // TASKLOOP DIRECTIVE
13554 #pragma omp taskloop
13555   for (int i = 0; i < 10; ++i) {
13556 #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?}}
13557     for (int i = 0; i < 10; ++i)
13558       ;
13559   }
13560 #pragma omp taskloop
13561   for (int i = 0; i < 10; ++i) {
13562 #pragma omp simd
13563     for (int i = 0; i < 10; ++i)
13564       ;
13565   }
13566 #pragma omp taskloop
13567   for (int i = 0; i < 10; ++i) {
13568 #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?}}
13569     for (int i = 0; i < 10; ++i)
13570       ;
13571   }
13572 #pragma omp taskloop
13573   for (int i = 0; i < 10; ++i) {
13574 #pragma omp parallel
13575     for (int i = 0; i < 10; ++i)
13576       ;
13577   }
13578 #pragma omp taskloop
13579   for (int i = 0; i < 10; ++i) {
13580 #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?}}
13581     {
13582       bar();
13583     }
13584   }
13585 #pragma omp taskloop
13586   for (int i = 0; i < 10; ++i) {
13587 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a taskloop region}}
13588     {
13589       bar();
13590     }
13591   }
13592 #pragma omp taskloop
13593   for (int i = 0; i < 10; ++i) {
13594 #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?}}
13595     {
13596       bar();
13597     }
13598   }
13599 
13600 #pragma omp taskloop
13601   for (int i = 0; i < 10; ++i) {
13602 #pragma omp master // expected-error {{region cannot be closely nested inside 'taskloop' region}}
13603     {
13604       bar();
13605     }
13606   }
13607 #pragma omp taskloop
13608   for (int i = 0; i < 10; ++i) {
13609 #pragma omp critical
13610     {
13611       bar();
13612     }
13613   }
13614 #pragma omp taskloop
13615   for (int i = 0; i < 10; ++i) {
13616 #pragma omp parallel
13617     {
13618 #pragma omp single // OK
13619       {
13620         bar();
13621       }
13622 #pragma omp for // OK
13623       for (int i = 0; i < 10; ++i)
13624         ;
13625 #pragma omp sections // OK
13626       {
13627         bar();
13628       }
13629     }
13630   }
13631 #pragma omp taskloop
13632   for (int i = 0; i < 10; ++i) {
13633 #pragma omp parallel for
13634     for (int i = 0; i < 10; ++i)
13635       ;
13636   }
13637 #pragma omp taskloop
13638   for (int i = 0; i < 10; ++i) {
13639 #pragma omp parallel for simd
13640     for (int i = 0; i < 10; ++i)
13641       ;
13642   }
13643 #pragma omp taskloop
13644   for (int i = 0; i < 10; ++i) {
13645 #pragma omp parallel sections
13646     {
13647       bar();
13648     }
13649   }
13650 #pragma omp taskloop
13651   for (int i = 0; i < 10; ++i) {
13652 #pragma omp task
13653     {
13654       bar();
13655     }
13656   }
13657 #pragma omp taskloop
13658   for (int i = 0; i < 10; ++i) {
13659 #pragma omp taskyield
13660     bar();
13661   }
13662 #pragma omp taskloop
13663   for (int i = 0; i < 10; ++i) {
13664 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'taskloop' region}}
13665     bar();
13666   }
13667 #pragma omp taskloop
13668   for (int i = 0; i < 10; ++i) {
13669 #pragma omp taskwait
13670     bar();
13671   }
13672 #pragma omp taskloop
13673   for (int i = 0; i < 10; ++i) {
13674 #pragma omp flush
13675     bar();
13676   }
13677 #pragma omp taskloop
13678   for (int i = 0; i < 10; ++i) {
13679 #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?}}
13680     bar();
13681   }
13682 #pragma omp taskloop
13683   for (int i = 0; i < 10; ++i) {
13684 #pragma omp atomic
13685     ++a;
13686   }
13687 #pragma omp taskloop
13688   for (int i = 0; i < 10; ++i) {
13689 #pragma omp target
13690     ++a;
13691   }
13692 #pragma omp taskloop
13693   for (int i = 0; i < 10; ++i) {
13694 #pragma omp target parallel
13695     ++a;
13696   }
13697 #pragma omp taskloop
13698   for (int i = 0; i < 10; ++i) {
13699 #pragma omp target parallel for
13700     for (int i = 0; i < 10; ++i)
13701       ;
13702   }
13703 #pragma omp taskloop
13704   for (int i = 0; i < 10; ++i) {
13705 #pragma omp target enter data map(to: a)
13706     ++a;
13707   }
13708 #pragma omp taskloop
13709   for (int i = 0; i < 10; ++i) {
13710 #pragma omp target exit data map(from: a)
13711     ++a;
13712   }
13713 #pragma omp taskloop
13714   for (int i = 0; i < 10; ++i) {
13715 #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?}}
13716     ++a;
13717   }
13718 #pragma omp taskloop
13719   for (int i = 0; i < 10; ++i) {
13720 #pragma omp taskloop
13721   for (int i = 0; i < 10; ++i)
13722     ++a;
13723   }
13724 #pragma omp taskloop
13725   for (int i = 0; i < 10; ++i) {
13726 #pragma omp target update to(a)
13727     ++a;
13728   }
13729 #pragma omp taskloop
13730   for (int i = 0; i < 10; ++i) {
13731 #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?}}
13732     for (int i = 0; i < 10; ++i)
13733       ;
13734   }
13735 #pragma omp taskloop
13736   for (int i = 0; i < 10; ++i) {
13737 #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?}}
13738     for (int i = 0; i < 10; ++i)
13739       ;
13740   }
13741 #pragma omp taskloop
13742   for (int i = 0; i < 10; ++i) {
13743 #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?}}
13744     for (int i = 0; i < 10; ++i)
13745       ;
13746   }
13747 #pragma omp taskloop
13748   for (int i = 0; i < 10; ++i) {
13749 #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?}}
13750     for (int i = 0; i < 10; ++i)
13751       ;
13752   }
13753 #pragma omp taskloop
13754   for (int i = 0; i < 10; ++i) {
13755 #pragma omp target simd // OK
13756     for (int i = 0; i < 10; ++i)
13757       ;
13758   }
13759 #pragma omp taskloop
13760   for (int i = 0; i < 10; ++i) {
13761 #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?}}
13762     for (int i = 0; i < 10; ++i)
13763       ;
13764   }
13765 #pragma omp taskloop
13766   for (int i = 0; i < 10; ++i) {
13767 #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?}}
13768     for (int i = 0; i < 10; ++i)
13769       ;
13770   }
13771 #pragma omp taskloop
13772   for (int i = 0; i < 10; ++i) {
13773 #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?}}
13774     for (int i = 0; i < 10; ++i)
13775       ;
13776   }
13777 #pragma omp taskloop
13778   for (int i = 0; i < 10; ++i) {
13779 #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?}}
13780     for (int i = 0; i < 10; ++i)
13781       ;
13782   }
13783 #pragma omp taskloop
13784   for (int i = 0; i < 10; ++i) {
13785 #pragma omp target teams // OK
13786     a++;
13787   }
13788 #pragma omp taskloop
13789   for (int i = 0; i < 10; ++i) {
13790 #pragma omp target teams distribute // OK
13791     for (int i = 0; i < 10; ++i)
13792       ;
13793   }
13794 #pragma omp taskloop
13795   for (int i = 0; i < 10; ++i) {
13796 #pragma omp target teams distribute parallel for // OK
13797     for (int i = 0; i < 10; ++i)
13798       ;
13799   }
13800 #pragma omp taskloop
13801   for (int i = 0; i < 10; ++i) {
13802 #pragma omp target teams distribute parallel for simd // OK
13803     for (int i = 0; i < 10; ++i)
13804       ;
13805   }
13806 #pragma omp taskloop
13807   for (int i = 0; i < 10; ++i) {
13808 #pragma omp target teams distribute simd // OK
13809     for (int i = 0; i < 10; ++i)
13810       ;
13811   }
13812 
13813 // DISTRIBUTE DIRECTIVE
13814 #pragma omp target
13815 #pragma omp teams
13816 #pragma omp distribute
13817   for (int i = 0; i < 10; ++i) {
13818 #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?}}
13819     for (int i = 0; i < 10; ++i)
13820       ;
13821   }
13822 #pragma omp target
13823 #pragma omp teams
13824 #pragma omp distribute
13825   for (int i = 0; i < 10; ++i) {
13826 #pragma omp for
13827     for (int i = 0; i < 10; ++i)
13828       ;
13829   }
13830 #pragma omp target
13831 #pragma omp teams
13832 #pragma omp distribute
13833   for (int i = 0; i < 10; ++i) {
13834 #pragma omp simd
13835     for (int i = 0; i < 10; ++i)
13836       ;
13837   }
13838 #pragma omp target
13839 #pragma omp teams
13840 #pragma omp distribute
13841   for (int i = 0; i < 10; ++i) {
13842 #pragma omp for simd
13843     for (int i = 0; i < 10; ++i)
13844       ;
13845   }
13846 #pragma omp target
13847 #pragma omp teams
13848 #pragma omp distribute
13849   for (int i = 0; i < 10; ++i) {
13850 #pragma omp parallel
13851     for (int i = 0; i < 10; ++i)
13852       ;
13853   }
13854 #pragma omp target
13855 #pragma omp teams
13856 #pragma omp distribute
13857   for (int i = 0; i < 10; ++i) {
13858 #pragma omp sections
13859     {
13860       bar();
13861     }
13862   }
13863 #pragma omp target
13864 #pragma omp teams
13865 #pragma omp distribute
13866   for (int i = 0; i < 10; ++i) {
13867 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute region}}
13868     {
13869       bar();
13870     }
13871   }
13872 #pragma omp target
13873 #pragma omp teams
13874 #pragma omp distribute
13875   for (int i = 0; i < 10; ++i) {
13876 #pragma omp single
13877     {
13878       bar();
13879     }
13880   }
13881 #pragma omp target
13882 #pragma omp teams
13883 #pragma omp distribute
13884   for (int i = 0; i < 10; ++i) {
13885 #pragma omp master
13886     {
13887       bar();
13888     }
13889   }
13890 #pragma omp target
13891 #pragma omp teams
13892 #pragma omp distribute
13893   for (int i = 0; i < 10; ++i) {
13894 #pragma omp critical
13895     {
13896       bar();
13897     }
13898   }
13899 #pragma omp target
13900 #pragma omp teams
13901 #pragma omp distribute
13902   for (int i = 0; i < 10; ++i) {
13903 #pragma omp parallel
13904     {
13905 #pragma omp single
13906       {
13907 	bar();
13908       }
13909     }
13910   }
13911 #pragma omp target
13912 #pragma omp teams
13913 #pragma omp distribute
13914   for (int i = 0; i < 10; ++i) {
13915 #pragma omp parallel for
13916     for (int i = 0; i < 10; ++i)
13917       ;
13918   }
13919 #pragma omp target
13920 #pragma omp teams
13921 #pragma omp distribute
13922   for (int i = 0; i < 10; ++i) {
13923 #pragma omp parallel for simd
13924     for (int i = 0; i < 10; ++i)
13925       ;
13926   }
13927 #pragma omp target
13928 #pragma omp teams
13929 #pragma omp distribute
13930   for (int i = 0; i < 10; ++i) {
13931 #pragma omp parallel sections
13932     {
13933       bar();
13934     }
13935   }
13936 #pragma omp target
13937 #pragma omp teams
13938 #pragma omp distribute
13939   for (int i = 0; i < 10; ++i) {
13940 #pragma omp task
13941     {
13942       bar();
13943     }
13944   }
13945 #pragma omp target
13946 #pragma omp teams
13947 #pragma omp distribute
13948   for (int i = 0; i < 10; ++i) {
13949 #pragma omp taskyield
13950     bar();
13951   }
13952 #pragma omp target
13953 #pragma omp teams
13954 #pragma omp distribute
13955   for (int i = 0; i < 10; ++i) {
13956 #pragma omp barrier
13957     bar();
13958   }
13959 #pragma omp target
13960 #pragma omp teams
13961 #pragma omp distribute
13962   for (int i = 0; i < 10; ++i) {
13963 #pragma omp taskwait
13964     bar();
13965   }
13966 #pragma omp target
13967 #pragma omp teams
13968 #pragma omp distribute
13969   for (int i = 0; i < 10; ++i) {
13970 #pragma omp flush
13971     bar();
13972   }
13973 #pragma omp target
13974 #pragma omp teams
13975 #pragma omp distribute
13976   for (int i = 0; i < 10; ++i) {
13977 #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?}}
13978     bar();
13979   }
13980 #pragma omp target
13981 #pragma omp teams
13982 #pragma omp distribute
13983   for (int i = 0; i < 10; ++i) {
13984 #pragma omp atomic
13985     ++a;
13986   }
13987 #pragma omp target
13988 #pragma omp teams
13989 #pragma omp distribute
13990   for (int i = 0; i < 10; ++i) {
13991 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
13992     ++a;
13993   }
13994 #pragma omp target
13995 #pragma omp teams
13996 #pragma omp distribute
13997   for (int i = 0; i < 10; ++i) {
13998 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
13999     ++a;
14000   }
14001 #pragma omp target
14002 #pragma omp teams
14003 #pragma omp distribute
14004   for (int i = 0; i < 10; ++i) {
14005 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
14006     for (int i = 0; i < 10; ++i)
14007       ;
14008   }
14009 #pragma omp target
14010 #pragma omp teams
14011 #pragma omp distribute
14012   for (int i = 0; i < 10; ++i) {
14013 #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?}}
14014     ++a;
14015   }
14016 #pragma omp target
14017 #pragma omp teams
14018 #pragma omp distribute
14019   for (int i = 0; i < 10; ++i) {
14020 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
14021     ++a;
14022   }
14023 #pragma omp target
14024 #pragma omp teams
14025 #pragma omp distribute
14026   for (int i = 0; i < 10; ++i) {
14027 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
14028     ++a;
14029   }
14030 #pragma omp target
14031 #pragma omp teams
14032 #pragma omp distribute
14033   for (int i = 0; i < 10; ++i) {
14034 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
14035     ++a;
14036   }
14037 #pragma omp target
14038 #pragma omp teams
14039 #pragma omp distribute
14040   for (int i = 0; i < 10; ++i) {
14041 #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?}}
14042   for (int i = 0; i < 10; ++i)
14043     ++a;
14044   }
14045 #pragma omp target
14046 #pragma omp teams
14047 #pragma omp distribute
14048   for (int i = 0; i < 10; ++i) {
14049 #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?}}
14050   for (int i = 0; i < 10; ++i)
14051     ++a;
14052   }
14053 #pragma omp target
14054 #pragma omp teams
14055 #pragma omp distribute
14056   for (int i = 0; i < 10; ++i) {
14057 #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?}}
14058   for (int i = 0; i < 10; ++i)
14059     ++a;
14060   }
14061 #pragma omp target
14062 #pragma omp teams
14063 #pragma omp distribute
14064   for (int i = 0; i < 10; ++i) {
14065 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
14066   for (int i = 0; i < 10; ++i)
14067     ++a;
14068   }
14069 #pragma omp target
14070 #pragma omp teams
14071 #pragma omp distribute
14072   for (int i = 0; i < 10; ++i) {
14073 #pragma omp target parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
14074   for (int i = 0; i < 10; ++i)
14075     ++a;
14076   }
14077 #pragma omp target
14078 #pragma omp teams
14079 #pragma omp distribute
14080   for (int i = 0; i < 10; ++i) {
14081 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
14082   for (int i = 0; i < 10; ++i)
14083     ++a;
14084   }
14085 #pragma omp target
14086 #pragma omp teams
14087 #pragma omp distribute
14088   for (int i = 0; i < 10; ++i) {
14089 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
14090   for (int i = 0; i < 10; ++i)
14091     ++a;
14092   }
14093 #pragma omp target
14094 #pragma omp teams
14095 #pragma omp distribute
14096   for (int i = 0; i < 10; ++i) {
14097 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
14098   for (int i = 0; i < 10; ++i)
14099     ++a;
14100   }
14101 #pragma omp target
14102 #pragma omp teams
14103 #pragma omp distribute
14104   for (int i = 0; i < 10; ++i) {
14105 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
14106   for (int i = 0; i < 10; ++i)
14107     ++a;
14108   }
14109 #pragma omp target
14110 #pragma omp teams
14111 #pragma omp distribute
14112   for (int i = 0; i < 10; ++i) {
14113 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
14114   for (int i = 0; i < 10; ++i)
14115     ++a;
14116   }
14117 #pragma omp target
14118 #pragma omp teams
14119 #pragma omp distribute
14120   for (int i = 0; i < 10; ++i) {
14121 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
14122   for (int i = 0; i < 10; ++i)
14123     ++a;
14124   }
14125 
14126 // DISTRIBUTE PARALLEL FOR DIRECTIVE
14127 #pragma omp target
14128 #pragma omp teams
14129 #pragma omp distribute parallel for
14130   for (int i = 0; i < 10; ++i) {
14131 #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?}}
14132     for (int i = 0; i < 10; ++i)
14133       ;
14134   }
14135 
14136 #pragma omp target
14137 #pragma omp teams
14138 #pragma omp distribute parallel for
14139   for (int i = 0; i < 10; ++i) {
14140 #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?}}
14141     for (int i = 0; i < 10; ++i)
14142       ;
14143   }
14144 #pragma omp target
14145 #pragma omp teams
14146 #pragma omp distribute parallel for
14147   for (int i = 0; i < 10; ++i) {
14148 #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?}}
14149     for (int i = 0; i < 10; ++i)
14150       ;
14151   }
14152 #pragma omp target
14153 #pragma omp teams
14154 #pragma omp distribute parallel for
14155   for (int i = 0; i < 10; ++i) {
14156 #pragma omp simd
14157     for (int i = 0; i < 10; ++i)
14158       ;
14159   }
14160 #pragma omp target
14161 #pragma omp teams
14162 #pragma omp distribute parallel for
14163   for (int i = 0; i < 10; ++i) {
14164 #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?}}
14165     for (int i = 0; i < 10; ++i)
14166       ;
14167   }
14168 #pragma omp target
14169 #pragma omp teams
14170 #pragma omp distribute parallel for
14171   for (int i = 0; i < 10; ++i) {
14172 #pragma omp parallel
14173     for (int i = 0; i < 10; ++i)
14174       ;
14175   }
14176 #pragma omp target
14177 #pragma omp teams
14178 #pragma omp distribute parallel for
14179   for (int i = 0; i < 10; ++i) {
14180 #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?}}
14181     {
14182       bar();
14183     }
14184   }
14185 #pragma omp target
14186 #pragma omp teams
14187 #pragma omp distribute parallel for
14188   for (int i = 0; i < 10; ++i) {
14189 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute parallel for region}}
14190     {
14191       bar();
14192     }
14193   }
14194 #pragma omp target
14195 #pragma omp teams
14196 #pragma omp distribute parallel for
14197   for (int i = 0; i < 10; ++i) {
14198 #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?}}
14199     {
14200       bar();
14201     }
14202   }
14203 #pragma omp target
14204 #pragma omp teams
14205 #pragma omp distribute parallel for
14206   for (int i = 0; i < 10; ++i) {
14207 #pragma omp master // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}}
14208     {
14209       bar();
14210     }
14211   }
14212 #pragma omp target
14213 #pragma omp teams
14214 #pragma omp distribute parallel for
14215   for (int i = 0; i < 10; ++i) {
14216 #pragma omp critical
14217     {
14218       bar();
14219     }
14220   }
14221 #pragma omp target
14222 #pragma omp teams
14223 #pragma omp distribute parallel for
14224   for (int i = 0; i < 10; ++i) {
14225 #pragma omp parallel
14226     {
14227 #pragma omp single
14228       {
14229 	bar();
14230       }
14231     }
14232   }
14233 #pragma omp target
14234 #pragma omp teams
14235 #pragma omp distribute parallel for
14236   for (int i = 0; i < 10; ++i) {
14237 #pragma omp parallel for
14238     for (int i = 0; i < 10; ++i)
14239       ;
14240   }
14241 #pragma omp target
14242 #pragma omp teams
14243 #pragma omp distribute parallel for
14244   for (int i = 0; i < 10; ++i) {
14245 #pragma omp parallel for simd
14246     for (int i = 0; i < 10; ++i)
14247       ;
14248   }
14249 #pragma omp target
14250 #pragma omp teams
14251 #pragma omp distribute parallel for
14252   for (int i = 0; i < 10; ++i) {
14253 #pragma omp parallel sections
14254     {
14255       bar();
14256     }
14257   }
14258 #pragma omp target
14259 #pragma omp teams
14260 #pragma omp distribute parallel for
14261   for (int i = 0; i < 10; ++i) {
14262 #pragma omp task
14263     {
14264       bar();
14265     }
14266   }
14267 #pragma omp target
14268 #pragma omp teams
14269 #pragma omp distribute parallel for
14270   for (int i = 0; i < 10; ++i) {
14271 #pragma omp taskyield
14272     bar();
14273   }
14274 #pragma omp target
14275 #pragma omp teams
14276 #pragma omp distribute parallel for
14277   for (int i = 0; i < 10; ++i) {
14278 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'distribute parallel for' region}}
14279     bar();
14280   }
14281 #pragma omp target
14282 #pragma omp teams
14283 #pragma omp distribute parallel for
14284   for (int i = 0; i < 10; ++i) {
14285 #pragma omp taskwait
14286     bar();
14287   }
14288 #pragma omp target
14289 #pragma omp teams
14290 #pragma omp distribute parallel for
14291   for (int i = 0; i < 10; ++i) {
14292 #pragma omp flush
14293     bar();
14294   }
14295 #pragma omp target
14296 #pragma omp teams
14297 #pragma omp distribute parallel for
14298   for (int i = 0; i < 10; ++i) {
14299 #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?}}
14300     bar();
14301   }
14302 #pragma omp target
14303 #pragma omp teams
14304 #pragma omp distribute parallel for
14305   for (int i = 0; i < 10; ++i) {
14306 #pragma omp atomic
14307     ++a;
14308   }
14309 #pragma omp target
14310 #pragma omp teams
14311 #pragma omp distribute parallel for
14312   for (int i = 0; i < 10; ++i) {
14313 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
14314     ++a;
14315   }
14316 #pragma omp target
14317 #pragma omp teams
14318 #pragma omp distribute parallel for
14319   for (int i = 0; i < 10; ++i) {
14320 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target' region}}
14321     ++a;
14322   }
14323 #pragma omp target
14324 #pragma omp teams
14325 #pragma omp distribute parallel for
14326   for (int i = 0; i < 10; ++i) {
14327 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
14328     for (int i = 0; i < 10; ++i)
14329       ;
14330   }
14331 #pragma omp target
14332 #pragma omp teams
14333 #pragma omp distribute parallel for
14334   for (int i = 0; i < 10; ++i) {
14335 #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?}}
14336     ++a;
14337   }
14338 #pragma omp target
14339 #pragma omp teams
14340 #pragma omp distribute parallel for
14341   for (int i = 0; i < 10; ++i) {
14342 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
14343     ++a;
14344   }
14345 #pragma omp target
14346 #pragma omp teams
14347 #pragma omp distribute parallel for
14348   for (int i = 0; i < 10; ++i) {
14349 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
14350     ++a;
14351   }
14352 #pragma omp target
14353 #pragma omp teams
14354 #pragma omp distribute parallel for
14355   for (int i = 0; i < 10; ++i) {
14356 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
14357     ++a;
14358   }
14359 #pragma omp target
14360 #pragma omp teams
14361 #pragma omp distribute parallel for
14362   for (int i = 0; i < 10; ++i) {
14363 #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?}}
14364   for (int i = 0; i < 10; ++i)
14365     ++a;
14366   }
14367 #pragma omp target
14368 #pragma omp teams
14369 #pragma omp distribute parallel for
14370   for (int i = 0; i < 10; ++i) {
14371 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
14372   for (int i = 0; i < 10; ++i)
14373     ++a;
14374   }
14375 #pragma omp target
14376 #pragma omp teams
14377 #pragma omp distribute parallel for
14378   for (int i = 0; i < 10; ++i) {
14379 #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?}}
14380   for (int i = 0; i < 10; ++i)
14381     ++a;
14382   }
14383 #pragma omp target
14384 #pragma omp teams
14385 #pragma omp distribute parallel for
14386   for (int i = 0; i < 10; ++i) {
14387 #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?}}
14388   for (int i = 0; i < 10; ++i)
14389     ++a;
14390   }
14391 #pragma omp target
14392 #pragma omp teams
14393 #pragma omp distribute parallel for
14394   for (int i = 0; i < 10; ++i) {
14395 #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?}}
14396   for (int i = 0; i < 10; ++i)
14397     ++a;
14398   }
14399 #pragma omp target
14400 #pragma omp teams
14401 #pragma omp distribute parallel for
14402   for (int i = 0; i < 10; ++i) {
14403 #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?}}
14404   for (int i = 0; i < 10; ++i)
14405     ++a;
14406   }
14407 #pragma omp target
14408 #pragma omp teams
14409 #pragma omp distribute parallel for
14410   for (int i = 0; i < 10; ++i) {
14411 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
14412     ++a;
14413   }
14414 #pragma omp target
14415 #pragma omp teams
14416 #pragma omp distribute parallel for
14417   for (int i = 0; i < 10; ++i) {
14418 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
14419   for (int i = 0; i < 10; ++i)
14420     ++a;
14421   }
14422 #pragma omp target
14423 #pragma omp teams
14424 #pragma omp distribute parallel for
14425   for (int i = 0; i < 10; ++i) {
14426 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
14427   for (int i = 0; i < 10; ++i)
14428     ++a;
14429   }
14430 #pragma omp target
14431 #pragma omp teams
14432 #pragma omp distribute parallel for
14433   for (int i = 0; i < 10; ++i) {
14434 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
14435   for (int i = 0; i < 10; ++i)
14436     ++a;
14437   }
14438 #pragma omp target
14439 #pragma omp teams
14440 #pragma omp distribute parallel for
14441   for (int i = 0; i < 10; ++i) {
14442 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
14443   for (int i = 0; i < 10; ++i)
14444     ++a;
14445   }
14446 
14447 // DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
14448 #pragma omp target
14449 #pragma omp teams
14450 #pragma omp distribute parallel for simd
14451   for (int i = 0; i < 10; ++i) {
14452 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14453     for (int i = 0; i < 10; ++i)
14454       ;
14455   }
14456 #pragma omp target
14457 #pragma omp teams
14458 #pragma omp distribute parallel for simd
14459   for (int i = 0; i < 10; ++i) {
14460 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14461     for (int i = 0; i < 10; ++i)
14462       ;
14463   }
14464 #pragma omp target
14465 #pragma omp teams
14466 #pragma omp distribute parallel for simd
14467   for (int i = 0; i < 10; ++i) {
14468 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14469     for (int i = 0; i < 10; ++i)
14470       ;
14471   }
14472 #pragma omp target
14473 #pragma omp teams
14474 #pragma omp distribute parallel for simd
14475   for (int i = 0; i < 10; ++i) {
14476 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
14477     for (int i = 0; i < 10; ++i)
14478       ;
14479   }
14480 #pragma omp target
14481 #pragma omp teams
14482 #pragma omp distribute parallel for simd
14483   for (int i = 0; i < 10; ++i) {
14484 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14485     for (int i = 0; i < 10; ++i)
14486       ;
14487   }
14488 #pragma omp target
14489 #pragma omp teams
14490 #pragma omp distribute parallel for simd
14491   for (int i = 0; i < 10; ++i) {
14492 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14493     for (int i = 0; i < 10; ++i)
14494       ;
14495   }
14496 #pragma omp target
14497 #pragma omp teams
14498 #pragma omp distribute parallel for simd
14499   for (int i = 0; i < 10; ++i) {
14500 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14501     {
14502       bar();
14503     }
14504   }
14505 #pragma omp target
14506 #pragma omp teams
14507 #pragma omp distribute parallel for simd
14508   for (int i = 0; i < 10; ++i) {
14509 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14510     {
14511       bar();
14512     }
14513   }
14514 #pragma omp target
14515 #pragma omp teams
14516 #pragma omp distribute parallel for simd
14517   for (int i = 0; i < 10; ++i) {
14518 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14519     {
14520       bar();
14521     }
14522   }
14523 #pragma omp target
14524 #pragma omp teams
14525 #pragma omp distribute parallel for simd
14526   for (int i = 0; i < 10; ++i) {
14527 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14528     {
14529       bar();
14530     }
14531   }
14532 #pragma omp target
14533 #pragma omp teams
14534 #pragma omp distribute parallel for simd
14535   for (int i = 0; i < 10; ++i) {
14536 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14537     {
14538       bar();
14539     }
14540   }
14541 #pragma omp target
14542 #pragma omp teams
14543 #pragma omp distribute parallel for simd
14544   for (int i = 0; i < 10; ++i) {
14545 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14546     {
14547 #pragma omp single
14548       {
14549 	bar();
14550       }
14551     }
14552   }
14553 #pragma omp target
14554 #pragma omp teams
14555 #pragma omp distribute parallel for simd
14556   for (int i = 0; i < 10; ++i) {
14557 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14558     for (int i = 0; i < 10; ++i)
14559       ;
14560   }
14561 #pragma omp target
14562 #pragma omp teams
14563 #pragma omp distribute parallel for simd
14564   for (int i = 0; i < 10; ++i) {
14565 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14566     for (int i = 0; i < 10; ++i)
14567       ;
14568   }
14569 #pragma omp target
14570 #pragma omp teams
14571 #pragma omp distribute parallel for simd
14572   for (int i = 0; i < 10; ++i) {
14573 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14574     {
14575       bar();
14576     }
14577   }
14578 #pragma omp target
14579 #pragma omp teams
14580 #pragma omp distribute parallel for simd
14581   for (int i = 0; i < 10; ++i) {
14582 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14583     {
14584       bar();
14585     }
14586   }
14587 #pragma omp target
14588 #pragma omp teams
14589 #pragma omp distribute parallel for simd
14590   for (int i = 0; i < 10; ++i) {
14591 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14592     bar();
14593   }
14594 #pragma omp target
14595 #pragma omp teams
14596 #pragma omp distribute parallel for simd
14597   for (int i = 0; i < 10; ++i) {
14598 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14599     bar();
14600   }
14601 #pragma omp target
14602 #pragma omp teams
14603 #pragma omp distribute parallel for simd
14604   for (int i = 0; i < 10; ++i) {
14605 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14606     bar();
14607   }
14608 #pragma omp target
14609 #pragma omp teams
14610 #pragma omp distribute parallel for simd
14611   for (int i = 0; i < 10; ++i) {
14612 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14613     bar();
14614   }
14615 #pragma omp target
14616 #pragma omp teams
14617 #pragma omp distribute parallel for simd
14618   for (int i = 0; i < 10; ++i) {
14619 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14620     bar();
14621   }
14622 #pragma omp target
14623 #pragma omp teams
14624 #pragma omp distribute parallel for simd
14625   for (int i = 0; i < 10; ++i) {
14626 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14627     ++a;
14628   }
14629 #pragma omp target
14630 #pragma omp teams
14631 #pragma omp distribute parallel for simd
14632   for (int i = 0; i < 10; ++i) {
14633 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14634     ++a;
14635   }
14636 #pragma omp target
14637 #pragma omp teams
14638 #pragma omp distribute parallel for simd
14639   for (int i = 0; i < 10; ++i) {
14640 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14641     ++a;
14642   }
14643 #pragma omp target
14644 #pragma omp teams
14645 #pragma omp distribute parallel for simd
14646   for (int i = 0; i < 10; ++i) {
14647 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14648     ++a;
14649   }
14650 #pragma omp target
14651 #pragma omp teams
14652 #pragma omp distribute parallel for simd
14653   for (int i = 0; i < 10; ++i) {
14654 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14655     ++a;
14656   }
14657 #pragma omp target
14658 #pragma omp teams
14659 #pragma omp distribute parallel for simd
14660   for (int i = 0; i < 10; ++i) {
14661 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14662     ++a;
14663   }
14664 #pragma omp target
14665 #pragma omp teams
14666 #pragma omp distribute parallel for simd
14667   for (int i = 0; i < 10; ++i) {
14668 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14669     ++a;
14670   }
14671 #pragma omp target
14672 #pragma omp teams
14673 #pragma omp distribute parallel for simd
14674   for (int i = 0; i < 10; ++i) {
14675 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14676     for (int i = 0; i < 10; ++i)
14677       ;
14678   }
14679 #pragma omp target
14680 #pragma omp teams
14681 #pragma omp distribute parallel for simd
14682   for (int i = 0; i < 10; ++i) {
14683 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14684     for (int i = 0; i < 10; ++i)
14685       ;
14686   }
14687 #pragma omp target
14688 #pragma omp teams
14689 #pragma omp distribute parallel for simd
14690   for (int i = 0; i < 10; ++i) {
14691 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14692     for (int i = 0; i < 10; ++i)
14693       ;
14694   }
14695 #pragma omp target
14696 #pragma omp teams
14697 #pragma omp distribute parallel for simd
14698   for (int i = 0; i < 10; ++i) {
14699 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14700     for (int i = 0; i < 10; ++i)
14701       ;
14702   }
14703 #pragma omp target
14704 #pragma omp teams
14705 #pragma omp distribute parallel for simd
14706   for (int i = 0; i < 10; ++i) {
14707 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14708     for (int i = 0; i < 10; ++i)
14709       ;
14710   }
14711 #pragma omp target
14712 #pragma omp teams
14713 #pragma omp distribute parallel for simd
14714   for (int i = 0; i < 10; ++i) {
14715 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14716     for (int i = 0; i < 10; ++i)
14717       ;
14718   }
14719 #pragma omp target
14720 #pragma omp teams
14721 #pragma omp distribute parallel for simd
14722   for (int i = 0; i < 10; ++i) {
14723 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14724     a++;
14725   }
14726 #pragma omp target
14727 #pragma omp teams
14728 #pragma omp distribute parallel for simd
14729   for (int i = 0; i < 10; ++i) {
14730 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14731     for (int i = 0; i < 10; ++i)
14732       ;
14733   }
14734 #pragma omp target
14735 #pragma omp teams
14736 #pragma omp distribute parallel for simd
14737   for (int i = 0; i < 10; ++i) {
14738 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14739     for (int i = 0; i < 10; ++i)
14740       ;
14741   }
14742 #pragma omp target
14743 #pragma omp teams
14744 #pragma omp distribute parallel for simd
14745   for (int i = 0; i < 10; ++i) {
14746 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14747     for (int i = 0; i < 10; ++i)
14748       ;
14749   }
14750 #pragma omp target
14751 #pragma omp teams
14752 #pragma omp distribute parallel for simd
14753   for (int i = 0; i < 10; ++i) {
14754 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14755     for (int i = 0; i < 10; ++i)
14756       ;
14757   }
14758 
14759 // DISTRIBUTE SIMD DIRECTIVE
14760 #pragma omp target
14761 #pragma omp teams
14762 #pragma omp distribute simd
14763   for (int i = 0; i < 10; ++i) {
14764 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14765     for (int i = 0; i < 10; ++i)
14766       ;
14767   }
14768 #pragma omp target
14769 #pragma omp teams
14770 #pragma omp distribute simd
14771   for (int i = 0; i < 10; ++i) {
14772 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14773     for (int i = 0; i < 10; ++i)
14774       ;
14775   }
14776 #pragma omp target
14777 #pragma omp teams
14778 #pragma omp distribute simd
14779   for (int i = 0; i < 10; ++i) {
14780 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14781     for (int i = 0; i < 10; ++i)
14782       ;
14783   }
14784 #pragma omp target
14785 #pragma omp teams
14786 #pragma omp distribute simd
14787   for (int i = 0; i < 10; ++i) {
14788 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
14789     for (int i = 0; i < 10; ++i)
14790       ;
14791   }
14792 #pragma omp target
14793 #pragma omp teams
14794 #pragma omp distribute simd
14795   for (int i = 0; i < 10; ++i) {
14796 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14797     for (int i = 0; i < 10; ++i)
14798       ;
14799   }
14800 #pragma omp target
14801 #pragma omp teams
14802 #pragma omp distribute simd
14803   for (int i = 0; i < 10; ++i) {
14804 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14805     for (int i = 0; i < 10; ++i)
14806       ;
14807   }
14808 #pragma omp target
14809 #pragma omp teams
14810 #pragma omp distribute simd
14811   for (int i = 0; i < 10; ++i) {
14812 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14813     {
14814       bar();
14815     }
14816   }
14817 #pragma omp target
14818 #pragma omp teams
14819 #pragma omp distribute simd
14820   for (int i = 0; i < 10; ++i) {
14821 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14822     {
14823       bar();
14824     }
14825   }
14826 #pragma omp target
14827 #pragma omp teams
14828 #pragma omp distribute simd
14829   for (int i = 0; i < 10; ++i) {
14830 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14831     {
14832       bar();
14833     }
14834   }
14835 #pragma omp target
14836 #pragma omp teams
14837 #pragma omp distribute simd
14838   for (int i = 0; i < 10; ++i) {
14839 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14840     {
14841       bar();
14842     }
14843   }
14844 #pragma omp target
14845 #pragma omp teams
14846 #pragma omp distribute simd
14847   for (int i = 0; i < 10; ++i) {
14848 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14849     {
14850       bar();
14851     }
14852   }
14853 #pragma omp target
14854 #pragma omp teams
14855 #pragma omp distribute simd
14856   for (int i = 0; i < 10; ++i) {
14857 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14858     {
14859 #pragma omp single
14860       {
14861 	bar();
14862       }
14863     }
14864   }
14865 #pragma omp target
14866 #pragma omp teams
14867 #pragma omp distribute simd
14868   for (int i = 0; i < 10; ++i) {
14869 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14870     for (int i = 0; i < 10; ++i)
14871       ;
14872   }
14873 #pragma omp target
14874 #pragma omp teams
14875 #pragma omp distribute simd
14876   for (int i = 0; i < 10; ++i) {
14877 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14878     for (int i = 0; i < 10; ++i)
14879       ;
14880   }
14881 #pragma omp target
14882 #pragma omp teams
14883 #pragma omp distribute simd
14884   for (int i = 0; i < 10; ++i) {
14885 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14886     {
14887       bar();
14888     }
14889   }
14890 #pragma omp target
14891 #pragma omp teams
14892 #pragma omp distribute simd
14893   for (int i = 0; i < 10; ++i) {
14894 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14895     {
14896       bar();
14897     }
14898   }
14899 #pragma omp target
14900 #pragma omp teams
14901 #pragma omp distribute simd
14902   for (int i = 0; i < 10; ++i) {
14903 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14904     bar();
14905   }
14906 #pragma omp target
14907 #pragma omp teams
14908 #pragma omp distribute simd
14909   for (int i = 0; i < 10; ++i) {
14910 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14911     bar();
14912   }
14913 #pragma omp target
14914 #pragma omp teams
14915 #pragma omp distribute simd
14916   for (int i = 0; i < 10; ++i) {
14917 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14918     bar();
14919   }
14920 #pragma omp target
14921 #pragma omp teams
14922 #pragma omp distribute simd
14923   for (int i = 0; i < 10; ++i) {
14924 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14925     bar();
14926   }
14927 #pragma omp target
14928 #pragma omp teams
14929 #pragma omp distribute simd
14930   for (int i = 0; i < 10; ++i) {
14931 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14932     bar();
14933   }
14934 #pragma omp target
14935 #pragma omp teams
14936 #pragma omp distribute simd
14937   for (int i = 0; i < 10; ++i) {
14938 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14939     ++a;
14940   }
14941 #pragma omp target
14942 #pragma omp teams
14943 #pragma omp distribute simd
14944   for (int i = 0; i < 10; ++i) {
14945 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14946     ++a;
14947   }
14948 #pragma omp target
14949 #pragma omp teams
14950 #pragma omp distribute simd
14951   for (int i = 0; i < 10; ++i) {
14952 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14953     ++a;
14954   }
14955 #pragma omp target
14956 #pragma omp teams
14957 #pragma omp distribute simd
14958   for (int i = 0; i < 10; ++i) {
14959 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14960     ++a;
14961   }
14962 #pragma omp target
14963 #pragma omp teams
14964 #pragma omp distribute simd
14965   for (int i = 0; i < 10; ++i) {
14966 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14967     ++a;
14968   }
14969 #pragma omp target
14970 #pragma omp teams
14971 #pragma omp distribute simd
14972   for (int i = 0; i < 10; ++i) {
14973 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14974     ++a;
14975   }
14976 #pragma omp target
14977 #pragma omp teams
14978 #pragma omp distribute simd
14979   for (int i = 0; i < 10; ++i) {
14980 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14981     ++a;
14982   }
14983 #pragma omp target
14984 #pragma omp teams
14985 #pragma omp distribute simd
14986   for (int i = 0; i < 10; ++i) {
14987 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14988     for (int i = 0; i < 10; ++i)
14989       ;
14990   }
14991 #pragma omp target
14992 #pragma omp teams
14993 #pragma omp distribute simd
14994   for (int i = 0; i < 10; ++i) {
14995 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
14996     for (int i = 0; i < 10; ++i)
14997       ;
14998   }
14999 #pragma omp target
15000 #pragma omp teams
15001 #pragma omp distribute simd
15002   for (int i = 0; i < 10; ++i) {
15003 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15004     for (int i = 0; i < 10; ++i)
15005       ;
15006   }
15007 #pragma omp target
15008 #pragma omp teams
15009 #pragma omp distribute simd
15010   for (int i = 0; i < 10; ++i) {
15011 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15012     for (int i = 0; i < 10; ++i)
15013       ;
15014   }
15015 #pragma omp target
15016 #pragma omp teams
15017 #pragma omp distribute simd
15018   for (int i = 0; i < 10; ++i) {
15019 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15020     for (int i = 0; i < 10; ++i)
15021       ;
15022   }
15023 #pragma omp target
15024 #pragma omp teams
15025 #pragma omp distribute simd
15026   for (int i = 0; i < 10; ++i) {
15027 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15028     for (int i = 0; i < 10; ++i)
15029       ;
15030   }
15031 #pragma omp target
15032 #pragma omp teams
15033 #pragma omp distribute simd
15034   for (int i = 0; i < 10; ++i) {
15035 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15036     a++;
15037   }
15038 #pragma omp target
15039 #pragma omp teams
15040 #pragma omp distribute simd
15041   for (int i = 0; i < 10; ++i) {
15042 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15043     for (int i = 0; i < 10; ++i)
15044       ;
15045   }
15046 #pragma omp target
15047 #pragma omp teams
15048 #pragma omp distribute simd
15049   for (int i = 0; i < 10; ++i) {
15050 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15051     for (int i = 0; i < 10; ++i)
15052       ;
15053   }
15054 #pragma omp target
15055 #pragma omp teams
15056 #pragma omp distribute simd
15057   for (int i = 0; i < 10; ++i) {
15058 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15059     for (int i = 0; i < 10; ++i)
15060       ;
15061   }
15062 #pragma omp target
15063 #pragma omp teams
15064 #pragma omp distribute simd
15065   for (int i = 0; i < 10; ++i) {
15066 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15067     for (int i = 0; i < 10; ++i)
15068       ;
15069   }
15070 
15071 // TARGET SIMD DIRECTIVE
15072 #pragma omp target simd
15073   for (int i = 0; i < 10; ++i) {
15074 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15075     for (int i = 0; i < 10; ++i)
15076       ;
15077   }
15078 #pragma omp target simd
15079   for (int i = 0; i < 10; ++i) {
15080 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15081     for (int i = 0; i < 10; ++i)
15082       ;
15083   }
15084 #pragma omp target simd
15085   for (int i = 0; i < 10; ++i) {
15086 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15087     for (int i = 0; i < 10; ++i)
15088       ;
15089   }
15090 #pragma omp target simd
15091   for (int i = 0; i < 10; ++i) {
15092 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
15093     for (int i = 0; i < 10; ++i)
15094       ;
15095   }
15096 #pragma omp target simd
15097   for (int i = 0; i < 10; ++i) {
15098 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15099     for (int i = 0; i < 10; ++i)
15100       ;
15101   }
15102 #pragma omp target simd
15103   for (int i = 0; i < 10; ++i) {
15104 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15105     for (int i = 0; i < 10; ++i)
15106       ;
15107   }
15108 #pragma omp target simd
15109   for (int i = 0; i < 10; ++i) {
15110 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15111     {
15112       bar();
15113     }
15114   }
15115 #pragma omp target simd
15116   for (int i = 0; i < 10; ++i) {
15117 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15118     {
15119       bar();
15120     }
15121   }
15122 #pragma omp target simd
15123   for (int i = 0; i < 10; ++i) {
15124 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15125     {
15126       bar();
15127     }
15128   }
15129 #pragma omp target simd
15130   for (int i = 0; i < 10; ++i) {
15131 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15132     {
15133       bar();
15134     }
15135   }
15136 #pragma omp target simd
15137   for (int i = 0; i < 10; ++i) {
15138 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15139     {
15140       bar();
15141     }
15142   }
15143 #pragma omp target simd
15144   for (int i = 0; i < 10; ++i) {
15145 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15146     {
15147 #pragma omp single
15148       {
15149 	bar();
15150       }
15151     }
15152   }
15153 #pragma omp target simd
15154   for (int i = 0; i < 10; ++i) {
15155 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15156     for (int i = 0; i < 10; ++i)
15157       ;
15158   }
15159 #pragma omp target simd
15160   for (int i = 0; i < 10; ++i) {
15161 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15162     for (int i = 0; i < 10; ++i)
15163       ;
15164   }
15165 #pragma omp target simd
15166   for (int i = 0; i < 10; ++i) {
15167 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15168     {
15169       bar();
15170     }
15171   }
15172 #pragma omp target simd
15173   for (int i = 0; i < 10; ++i) {
15174 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15175     {
15176       bar();
15177     }
15178   }
15179 #pragma omp target simd
15180   for (int i = 0; i < 10; ++i) {
15181 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15182     bar();
15183   }
15184 #pragma omp target simd
15185   for (int i = 0; i < 10; ++i) {
15186 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15187     bar();
15188   }
15189 #pragma omp target simd
15190   for (int i = 0; i < 10; ++i) {
15191 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15192     bar();
15193   }
15194 #pragma omp target simd
15195   for (int i = 0; i < 10; ++i) {
15196 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15197     bar();
15198   }
15199 #pragma omp target simd
15200   for (int i = 0; i < 10; ++i) {
15201 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15202     bar();
15203   }
15204 #pragma omp target simd
15205   for (int i = 0; i < 10; ++i) {
15206 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15207     ++a;
15208   }
15209 #pragma omp target simd
15210   for (int i = 0; i < 10; ++i) {
15211 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15212     ++a;
15213   }
15214 #pragma omp target simd
15215   for (int i = 0; i < 10; ++i) {
15216 #pragma omp target parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15217     ++a;
15218   }
15219 #pragma omp target simd
15220   for (int i = 0; i < 10; ++i) {
15221 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15222     ++a;
15223   }
15224 #pragma omp target simd
15225   for (int i = 0; i < 10; ++i) {
15226 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15227     ++a;
15228   }
15229 #pragma omp target simd
15230   for (int i = 0; i < 10; ++i) {
15231 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15232     ++a;
15233   }
15234 #pragma omp target simd
15235   for (int i = 0; i < 10; ++i) {
15236 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15237     ++a;
15238   }
15239 #pragma omp target simd
15240   for (int i = 0; i < 10; ++i) {
15241 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15242     for (int i = 0; i < 10; ++i)
15243       ;
15244   }
15245 #pragma omp target simd
15246   for (int i = 0; i < 10; ++i) {
15247 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15248     for (int i = 0; i < 10; ++i)
15249       ;
15250   }
15251 #pragma omp target simd
15252   for (int i = 0; i < 10; ++i) {
15253 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15254     for (int i = 0; i < 10; ++i)
15255       ;
15256   }
15257 #pragma omp target simd
15258   for (int i = 0; i < 10; ++i) {
15259 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15260     for (int i = 0; i < 10; ++i)
15261       ;
15262   }
15263 #pragma omp target simd
15264   for (int i = 0; i < 10; ++i) {
15265 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15266     for (int i = 0; i < 10; ++i)
15267       ;
15268   }
15269 #pragma omp target simd
15270   for (int i = 0; i < 10; ++i) {
15271 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15272     for (int i = 0; i < 10; ++i)
15273       ;
15274   }
15275 #pragma omp target simd
15276   for (int i = 0; i < 10; ++i) {
15277 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15278     a++;
15279   }
15280 #pragma omp target simd
15281   for (int i = 0; i < 10; ++i) {
15282 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15283     for (int i = 0; i < 10; ++i)
15284       ;
15285   }
15286 #pragma omp target simd
15287   for (int i = 0; i < 10; ++i) {
15288 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15289     for (int i = 0; i < 10; ++i)
15290       ;
15291   }
15292 #pragma omp target simd
15293   for (int i = 0; i < 10; ++i) {
15294 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15295     for (int i = 0; i < 10; ++i)
15296       ;
15297   }
15298 #pragma omp target simd
15299   for (int i = 0; i < 10; ++i) {
15300 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15301     for (int i = 0; i < 10; ++i)
15302       ;
15303   }
15304 
15305 // TEAMS DISTRIBUTE DIRECTIVE
15306 #pragma omp teams distribute // expected-error {{orphaned 'omp teams distribute' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
15307   for (int i = 0; i < 10; ++i)
15308     ;
15309 #pragma omp target
15310 #pragma omp teams distribute
15311   for (int i = 0; i < 10; ++i) {
15312 #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?}}
15313     for (int i = 0; i < 10; ++i)
15314       ;
15315   }
15316 #pragma omp target
15317 #pragma omp teams distribute
15318   for (int i = 0; i < 10; ++i) {
15319 #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?}}
15320     for (int i = 0; i < 10; ++i)
15321       ;
15322   }
15323 #pragma omp target
15324 #pragma omp teams distribute
15325   for (int i = 0; i < 10; ++i) {
15326 #pragma omp for // OK
15327     for (int i = 0; i < 10; ++i)
15328       ;
15329   }
15330 #pragma omp target
15331 #pragma omp teams distribute
15332   for (int i = 0; i < 10; ++i) {
15333 #pragma omp simd // OK
15334     for (int i = 0; i < 10; ++i)
15335       ;
15336   }
15337 #pragma omp target
15338 #pragma omp teams distribute
15339   for (int i = 0; i < 10; ++i) {
15340 #pragma omp for simd // OK
15341     for (int i = 0; i < 10; ++i)
15342       ;
15343   }
15344 #pragma omp target
15345 #pragma omp teams distribute
15346   for (int i = 0; i < 10; ++i) {
15347 #pragma omp parallel // OK
15348     for (int i = 0; i < 10; ++i)
15349       ;
15350   }
15351 #pragma omp target
15352 #pragma omp teams distribute
15353   for (int i = 0; i < 10; ++i) {
15354 #pragma omp sections // OK
15355     {
15356       bar();
15357     }
15358   }
15359 #pragma omp target
15360 #pragma omp teams distribute
15361   for (int i = 0; i < 10; ++i) {
15362 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute region}}
15363     {
15364       bar();
15365     }
15366   }
15367 #pragma omp target
15368 #pragma omp teams distribute
15369   for (int i = 0; i < 10; ++i) {
15370 #pragma omp single // OK
15371     {
15372       bar();
15373     }
15374   }
15375 #pragma omp target
15376 #pragma omp teams distribute
15377   for (int i = 0; i < 10; ++i) {
15378 #pragma omp master // OK
15379     {
15380       bar();
15381     }
15382   }
15383 #pragma omp target
15384 #pragma omp teams distribute
15385   for (int i = 0; i < 10; ++i) {
15386 #pragma omp critical // OK
15387     {
15388       bar();
15389     }
15390   }
15391 #pragma omp target
15392 #pragma omp teams distribute
15393   for (int i = 0; i < 10; ++i) {
15394 #pragma omp parallel // OK
15395     {
15396 #pragma omp single
15397       {
15398 	bar();
15399       }
15400     }
15401   }
15402 #pragma omp target
15403 #pragma omp teams distribute
15404   for (int i = 0; i < 10; ++i) {
15405 #pragma omp parallel for // OK
15406     for (int i = 0; i < 10; ++i)
15407       ;
15408   }
15409 #pragma omp target
15410 #pragma omp teams distribute
15411   for (int i = 0; i < 10; ++i) {
15412 #pragma omp parallel for simd // OK
15413     for (int i = 0; i < 10; ++i)
15414       ;
15415   }
15416 #pragma omp target
15417 #pragma omp teams distribute
15418   for (int i = 0; i < 10; ++i) {
15419 #pragma omp parallel sections // OK
15420     {
15421       bar();
15422     }
15423   }
15424 #pragma omp target
15425 #pragma omp teams distribute
15426   for (int i = 0; i < 10; ++i) {
15427 #pragma omp task // OK
15428     {
15429       bar();
15430     }
15431   }
15432 #pragma omp target
15433 #pragma omp teams distribute
15434   for (int i = 0; i < 10; ++i) {
15435 #pragma omp taskyield // OK
15436     bar();
15437   }
15438 #pragma omp target
15439 #pragma omp teams distribute
15440   for (int i = 0; i < 10; ++i) {
15441 #pragma omp barrier // OK
15442     bar();
15443   }
15444 #pragma omp target
15445 #pragma omp teams distribute
15446   for (int i = 0; i < 10; ++i) {
15447 #pragma omp taskwait // OK
15448     bar();
15449   }
15450 #pragma omp target
15451 #pragma omp teams distribute
15452   for (int i = 0; i < 10; ++i) {
15453 #pragma omp flush // OK
15454     bar();
15455   }
15456 #pragma omp target
15457 #pragma omp teams distribute
15458   for (int i = 0; i < 10; ++i) {
15459 #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?}}
15460     bar();
15461   }
15462 #pragma omp target
15463 #pragma omp teams distribute
15464   for (int i = 0; i < 10; ++i) {
15465 #pragma omp atomic // OK
15466     ++a;
15467   }
15468 #pragma omp target
15469 #pragma omp teams distribute
15470   for (int i = 0; i < 10; ++i) {
15471 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
15472     ++a;
15473   }
15474 #pragma omp target
15475 #pragma omp teams distribute
15476   for (int i = 0; i < 10; ++i) {
15477 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
15478     ++a;
15479   }
15480 #pragma omp target
15481 #pragma omp teams distribute
15482   for (int i = 0; i < 10; ++i) {
15483 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
15484     for (int i = 0; i < 10; ++i)
15485       ;
15486   }
15487 #pragma omp target
15488 #pragma omp teams distribute
15489   for (int i = 0; i < 10; ++i) {
15490 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
15491     ++a;
15492   }
15493 #pragma omp target
15494 #pragma omp teams distribute
15495   for (int i = 0; i < 10; ++i) {
15496 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
15497     ++a;
15498   }
15499 #pragma omp target
15500 #pragma omp teams distribute
15501   for (int i = 0; i < 10; ++i) {
15502 #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?}}
15503     ++a;
15504   }
15505 #pragma omp target
15506 #pragma omp teams distribute
15507   for (int i = 0; i < 10; ++i) {
15508 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
15509     ++a;
15510   }
15511 #pragma omp target
15512 #pragma omp teams distribute
15513   for (int i = 0; i < 10; ++i) {
15514 #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?}}
15515     for (int i = 0; i < 10; ++i)
15516       ++a;
15517   }
15518 #pragma omp target
15519 #pragma omp teams distribute
15520   for (int i = 0; i < 10; ++i) {
15521 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
15522     for (int i = 0; i < 10; ++i)
15523       ++a;
15524   }
15525 #pragma omp target
15526 #pragma omp teams distribute
15527   for (int i = 0; i < 10; ++i) {
15528 #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?}}
15529     for (int i = 0; i < 10; ++i)
15530       ++a;
15531   }
15532 #pragma omp target
15533 #pragma omp teams distribute
15534   for (int i = 0; i < 10; ++i) {
15535 #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?}}
15536     for (int i = 0; i < 10; ++i)
15537       ++a;
15538   }
15539 #pragma omp target
15540 #pragma omp teams distribute
15541   for (int i = 0; i < 10; ++i) {
15542 #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?}}
15543     for (int i = 0; i < 10; ++i)
15544       ++a;
15545   }
15546 #pragma omp target
15547 #pragma omp teams distribute
15548   for (int i = 0; i < 10; ++i) {
15549 #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?}}
15550     for (int i = 0; i < 10; ++i)
15551       ++a;
15552   }
15553 #pragma omp target
15554 #pragma omp teams distribute
15555   for (int i = 0; i < 10; ++i) {
15556 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
15557     ++a;
15558   }
15559 #pragma omp target
15560 #pragma omp teams distribute
15561   for (int i = 0; i < 10; ++i) {
15562 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
15563     for (int i = 0; i < 10; ++i)
15564       ++a;
15565   }
15566 #pragma omp target
15567 #pragma omp teams distribute
15568   for (int i = 0; i < 10; ++i) {
15569 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
15570     for (int i = 0; i < 10; ++i)
15571       ++a;
15572   }
15573 #pragma omp target
15574 #pragma omp teams distribute
15575   for (int i = 0; i < 10; ++i) {
15576 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
15577     for (int i = 0; i < 10; ++i)
15578       ++a;
15579   }
15580 #pragma omp target
15581 #pragma omp teams distribute
15582   for (int i = 0; i < 10; ++i) {
15583 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
15584     for (int i = 0; i < 10; ++i)
15585       ++a;
15586   }
15587 
15588 // TEAMS DISTRIBUTE SIMD DIRECTIVE
15589 #pragma omp teams distribute simd // expected-error {{orphaned 'omp teams distribute simd' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
15590   for (int i = 0; i < 10; ++i)
15591     ;
15592 #pragma omp target
15593 #pragma omp teams distribute simd
15594   for (int i = 0; i < 10; ++i) {
15595 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15596     for (int i = 0; i < 10; ++i)
15597       ;
15598   }
15599 #pragma omp target
15600 #pragma omp teams distribute simd
15601   for (int i = 0; i < 10; ++i) {
15602 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15603     for (int i = 0; i < 10; ++i)
15604       ;
15605   }
15606 #pragma omp target
15607 #pragma omp teams distribute simd
15608   for (int i = 0; i < 10; ++i) {
15609 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15610     for (int i = 0; i < 10; ++i)
15611       ;
15612   }
15613 #pragma omp target
15614 #pragma omp teams distribute simd
15615   for (int i = 0; i < 10; ++i) {
15616 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
15617     for (int i = 0; i < 10; ++i)
15618       ;
15619   }
15620 #pragma omp target
15621 #pragma omp teams distribute simd
15622   for (int i = 0; i < 10; ++i) {
15623 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15624     for (int i = 0; i < 10; ++i)
15625       ;
15626   }
15627 #pragma omp target
15628 #pragma omp teams distribute simd
15629   for (int i = 0; i < 10; ++i) {
15630 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15631     for (int i = 0; i < 10; ++i)
15632       ;
15633   }
15634 #pragma omp target
15635 #pragma omp teams distribute simd
15636   for (int i = 0; i < 10; ++i) {
15637 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15638     {
15639       bar();
15640     }
15641   }
15642 #pragma omp target
15643 #pragma omp teams distribute simd
15644   for (int i = 0; i < 10; ++i) {
15645 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15646     {
15647       bar();
15648     }
15649   }
15650 #pragma omp target
15651 #pragma omp teams distribute simd
15652   for (int i = 0; i < 10; ++i) {
15653 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15654     {
15655       bar();
15656     }
15657   }
15658 #pragma omp target
15659 #pragma omp teams distribute simd
15660   for (int i = 0; i < 10; ++i) {
15661 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15662     {
15663       bar();
15664     }
15665   }
15666 #pragma omp target
15667 #pragma omp teams distribute simd
15668   for (int i = 0; i < 10; ++i) {
15669 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15670     {
15671       bar();
15672     }
15673   }
15674 #pragma omp target
15675 #pragma omp teams distribute simd
15676   for (int i = 0; i < 10; ++i) {
15677 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15678     {
15679 #pragma omp single
15680       {
15681 	bar();
15682       }
15683     }
15684   }
15685 #pragma omp target
15686 #pragma omp teams distribute simd
15687   for (int i = 0; i < 10; ++i) {
15688 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15689     for (int i = 0; i < 10; ++i)
15690       ;
15691   }
15692 #pragma omp target
15693 #pragma omp teams distribute simd
15694   for (int i = 0; i < 10; ++i) {
15695 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15696     for (int i = 0; i < 10; ++i)
15697       ;
15698   }
15699 #pragma omp target
15700 #pragma omp teams distribute simd
15701   for (int i = 0; i < 10; ++i) {
15702 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15703     {
15704       bar();
15705     }
15706   }
15707 #pragma omp target
15708 #pragma omp teams distribute simd
15709   for (int i = 0; i < 10; ++i) {
15710 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15711     {
15712       bar();
15713     }
15714   }
15715 #pragma omp target
15716 #pragma omp teams distribute simd
15717   for (int i = 0; i < 10; ++i) {
15718 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15719     bar();
15720   }
15721 #pragma omp target
15722 #pragma omp teams distribute simd
15723   for (int i = 0; i < 10; ++i) {
15724 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15725     bar();
15726   }
15727 #pragma omp target
15728 #pragma omp teams distribute simd
15729   for (int i = 0; i < 10; ++i) {
15730 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15731     bar();
15732   }
15733 #pragma omp target
15734 #pragma omp teams distribute simd
15735   for (int i = 0; i < 10; ++i) {
15736 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15737     bar();
15738   }
15739 #pragma omp target
15740 #pragma omp teams distribute simd
15741   for (int i = 0; i < 10; ++i) {
15742 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15743     bar();
15744   }
15745 #pragma omp target
15746 #pragma omp teams distribute simd
15747   for (int i = 0; i < 10; ++i) {
15748 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15749     ++a;
15750   }
15751 #pragma omp target
15752 #pragma omp teams distribute simd
15753   for (int i = 0; i < 10; ++i) {
15754 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15755     ++a;
15756   }
15757 #pragma omp target
15758 #pragma omp teams distribute simd
15759   for (int i = 0; i < 10; ++i) {
15760 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15761     ++a;
15762   }
15763 #pragma omp target
15764 #pragma omp teams distribute simd
15765   for (int i = 0; i < 10; ++i) {
15766 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15767     for (int i = 0; i < 10; ++i)
15768       ;
15769   }
15770 #pragma omp target
15771 #pragma omp teams distribute simd
15772   for (int i = 0; i < 10; ++i) {
15773 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15774     ++a;
15775   }
15776 #pragma omp target
15777 #pragma omp teams distribute simd
15778   for (int i = 0; i < 10; ++i) {
15779 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15780     ++a;
15781   }
15782 #pragma omp target
15783 #pragma omp teams distribute simd
15784   for (int i = 0; i < 10; ++i) {
15785 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15786     ++a;
15787   }
15788 #pragma omp target
15789 #pragma omp teams distribute simd
15790   for (int i = 0; i < 10; ++i) {
15791 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15792     ++a;
15793   }
15794 #pragma omp target
15795 #pragma omp teams distribute simd
15796   for (int i = 0; i < 10; ++i) {
15797 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15798     for (int i = 0; i < 10; ++i)
15799       ++a;
15800   }
15801 #pragma omp target
15802 #pragma omp teams distribute simd
15803   for (int i = 0; i < 10; ++i) {
15804 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15805     for (int i = 0; i < 10; ++i)
15806       ++a;
15807   }
15808 #pragma omp target
15809 #pragma omp teams distribute simd
15810   for (int i = 0; i < 10; ++i) {
15811 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15812     for (int i = 0; i < 10; ++i)
15813       ++a;
15814   }
15815 #pragma omp target
15816 #pragma omp teams distribute simd
15817   for (int i = 0; i < 10; ++i) {
15818 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15819     for (int i = 0; i < 10; ++i)
15820       ++a;
15821   }
15822 #pragma omp target
15823 #pragma omp teams distribute simd
15824   for (int i = 0; i < 10; ++i) {
15825 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15826     for (int i = 0; i < 10; ++i)
15827       ++a;
15828   }
15829 #pragma omp target
15830 #pragma omp teams distribute simd
15831   for (int i = 0; i < 10; ++i) {
15832 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15833     for (int i = 0; i < 10; ++i)
15834       ++a;
15835   }
15836 #pragma omp target
15837 #pragma omp teams distribute simd
15838   for (int i = 0; i < 10; ++i) {
15839 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15840     ++a;
15841   }
15842 #pragma omp target
15843 #pragma omp teams distribute simd
15844   for (int i = 0; i < 10; ++i) {
15845 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15846     for (int i = 0; i < 10; ++i)
15847       ++a;
15848   }
15849 #pragma omp target
15850 #pragma omp teams distribute simd
15851   for (int i = 0; i < 10; ++i) {
15852 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15853     for (int i = 0; i < 10; ++i)
15854       ++a;
15855   }
15856 #pragma omp target
15857 #pragma omp teams distribute simd
15858   for (int i = 0; i < 10; ++i) {
15859 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15860     for (int i = 0; i < 10; ++i)
15861       ++a;
15862   }
15863 #pragma omp target
15864 #pragma omp teams distribute simd
15865   for (int i = 0; i < 10; ++i) {
15866 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15867     for (int i = 0; i < 10; ++i)
15868       ++a;
15869   }
15870 
15871 // TEAMS DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
15872 #pragma omp teams distribute parallel for simd // expected-error {{orphaned 'omp teams distribute parallel for simd' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
15873   for (int i = 0; i < 10; ++i)
15874     ;
15875 #pragma omp target
15876 #pragma omp teams distribute parallel for simd
15877   for (int i = 0; i < 10; ++i) {
15878 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15879     for (int i = 0; i < 10; ++i)
15880       ;
15881   }
15882 #pragma omp target
15883 #pragma omp teams distribute parallel for simd
15884   for (int i = 0; i < 10; ++i) {
15885 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15886     for (int i = 0; i < 10; ++i)
15887       ;
15888   }
15889 #pragma omp target
15890 #pragma omp teams distribute parallel for simd
15891   for (int i = 0; i < 10; ++i) {
15892 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15893     for (int i = 0; i < 10; ++i)
15894       ;
15895   }
15896 #pragma omp target
15897 #pragma omp teams distribute parallel for simd
15898   for (int i = 0; i < 10; ++i) {
15899 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
15900     for (int i = 0; i < 10; ++i)
15901       ;
15902   }
15903 #pragma omp target
15904 #pragma omp teams distribute parallel for simd
15905   for (int i = 0; i < 10; ++i) {
15906 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15907     for (int i = 0; i < 10; ++i)
15908       ;
15909   }
15910 #pragma omp target
15911 #pragma omp teams distribute parallel for simd
15912   for (int i = 0; i < 10; ++i) {
15913 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15914     for (int i = 0; i < 10; ++i)
15915       ;
15916   }
15917 #pragma omp target
15918 #pragma omp teams distribute parallel for simd
15919   for (int i = 0; i < 10; ++i) {
15920 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15921     {
15922       bar();
15923     }
15924   }
15925 #pragma omp target
15926 #pragma omp teams distribute parallel for simd
15927   for (int i = 0; i < 10; ++i) {
15928 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15929     {
15930       bar();
15931     }
15932   }
15933 #pragma omp target
15934 #pragma omp teams distribute parallel for simd
15935   for (int i = 0; i < 10; ++i) {
15936 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15937     {
15938       bar();
15939     }
15940   }
15941 #pragma omp target
15942 #pragma omp teams distribute parallel for simd
15943   for (int i = 0; i < 10; ++i) {
15944 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15945     {
15946       bar();
15947     }
15948   }
15949 #pragma omp target
15950 #pragma omp teams distribute parallel for simd
15951   for (int i = 0; i < 10; ++i) {
15952 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15953     {
15954       bar();
15955     }
15956   }
15957 #pragma omp target
15958 #pragma omp teams distribute parallel for simd
15959   for (int i = 0; i < 10; ++i) {
15960 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15961     {
15962 #pragma omp single
15963       {
15964 	bar();
15965       }
15966     }
15967   }
15968 #pragma omp target
15969 #pragma omp teams distribute parallel for simd
15970   for (int i = 0; i < 10; ++i) {
15971 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15972     for (int i = 0; i < 10; ++i)
15973       ;
15974   }
15975 #pragma omp target
15976 #pragma omp teams distribute parallel for simd
15977   for (int i = 0; i < 10; ++i) {
15978 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15979     for (int i = 0; i < 10; ++i)
15980       ;
15981   }
15982 #pragma omp target
15983 #pragma omp teams distribute parallel for simd
15984   for (int i = 0; i < 10; ++i) {
15985 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15986     {
15987       bar();
15988     }
15989   }
15990 #pragma omp target
15991 #pragma omp teams distribute parallel for simd
15992   for (int i = 0; i < 10; ++i) {
15993 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
15994     {
15995       bar();
15996     }
15997   }
15998 #pragma omp target
15999 #pragma omp teams distribute parallel for simd
16000   for (int i = 0; i < 10; ++i) {
16001 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16002     bar();
16003   }
16004 #pragma omp target
16005 #pragma omp teams distribute parallel for simd
16006   for (int i = 0; i < 10; ++i) {
16007 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16008     bar();
16009   }
16010 #pragma omp target
16011 #pragma omp teams distribute parallel for simd
16012   for (int i = 0; i < 10; ++i) {
16013 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16014     bar();
16015   }
16016 #pragma omp target
16017 #pragma omp teams distribute parallel for simd
16018   for (int i = 0; i < 10; ++i) {
16019 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16020     bar();
16021   }
16022 #pragma omp target
16023 #pragma omp teams distribute parallel for simd
16024   for (int i = 0; i < 10; ++i) {
16025 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16026     bar();
16027   }
16028 #pragma omp target
16029 #pragma omp teams distribute parallel for simd
16030   for (int i = 0; i < 10; ++i) {
16031 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16032     ++a;
16033   }
16034 #pragma omp target
16035 #pragma omp teams distribute parallel for simd
16036   for (int i = 0; i < 10; ++i) {
16037 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16038     ++a;
16039   }
16040 #pragma omp target
16041 #pragma omp teams distribute parallel for simd
16042   for (int i = 0; i < 10; ++i) {
16043 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16044     ++a;
16045   }
16046 #pragma omp target
16047 #pragma omp teams distribute parallel for simd
16048   for (int i = 0; i < 10; ++i) {
16049 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16050     for (int i = 0; i < 10; ++i)
16051       ;
16052   }
16053 #pragma omp target
16054 #pragma omp teams distribute parallel for simd
16055   for (int i = 0; i < 10; ++i) {
16056 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16057     ++a;
16058   }
16059 #pragma omp target
16060 #pragma omp teams distribute parallel for simd
16061   for (int i = 0; i < 10; ++i) {
16062 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16063     ++a;
16064   }
16065 #pragma omp target
16066 #pragma omp teams distribute parallel for simd
16067   for (int i = 0; i < 10; ++i) {
16068 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16069     ++a;
16070   }
16071 #pragma omp target
16072 #pragma omp teams distribute parallel for simd
16073   for (int i = 0; i < 10; ++i) {
16074 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16075     ++a;
16076   }
16077 #pragma omp target
16078 #pragma omp teams distribute parallel for simd
16079   for (int i = 0; i < 10; ++i) {
16080 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16081     for (int i = 0; i < 10; ++i)
16082       ++a;
16083   }
16084 #pragma omp target
16085 #pragma omp teams distribute parallel for simd
16086   for (int i = 0; i < 10; ++i) {
16087 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16088     for (int i = 0; i < 10; ++i)
16089       ++a;
16090   }
16091 #pragma omp target
16092 #pragma omp teams distribute parallel for simd
16093   for (int i = 0; i < 10; ++i) {
16094 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16095     for (int i = 0; i < 10; ++i)
16096       ++a;
16097   }
16098 #pragma omp target
16099 #pragma omp teams distribute parallel for simd
16100   for (int i = 0; i < 10; ++i) {
16101 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16102     for (int i = 0; i < 10; ++i)
16103       ++a;
16104   }
16105 #pragma omp target
16106 #pragma omp teams distribute parallel for simd
16107   for (int i = 0; i < 10; ++i) {
16108 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16109     for (int i = 0; i < 10; ++i)
16110       ++a;
16111   }
16112 #pragma omp target
16113 #pragma omp teams distribute parallel for simd
16114   for (int i = 0; i < 10; ++i) {
16115 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16116     for (int i = 0; i < 10; ++i)
16117       ++a;
16118   }
16119 #pragma omp target
16120 #pragma omp teams distribute parallel for simd
16121   for (int i = 0; i < 10; ++i) {
16122 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16123     ++a;
16124   }
16125 #pragma omp target
16126 #pragma omp teams distribute parallel for simd
16127   for (int i = 0; i < 10; ++i) {
16128 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16129     for (int i = 0; i < 10; ++i)
16130       ++a;
16131   }
16132 #pragma omp target
16133 #pragma omp teams distribute parallel for simd
16134   for (int i = 0; i < 10; ++i) {
16135 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16136     for (int i = 0; i < 10; ++i)
16137       ++a;
16138   }
16139 #pragma omp target
16140 #pragma omp teams distribute parallel for simd
16141   for (int i = 0; i < 10; ++i) {
16142 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16143     for (int i = 0; i < 10; ++i)
16144       ++a;
16145   }
16146 #pragma omp target
16147 #pragma omp teams distribute parallel for simd
16148   for (int i = 0; i < 10; ++i) {
16149 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
16150     for (int i = 0; i < 10; ++i)
16151       ++a;
16152   }
16153 
16154 // TEAMS DISTRIBUTE PARALLEL FOR DIRECTIVE
16155 #pragma omp teams distribute parallel for // expected-error {{orphaned 'omp teams distribute parallel for' directives are prohibited; perhaps you forget to enclose the directive into a target region?}}
16156   for (int i = 0; i < 10; ++i)
16157     ;
16158 #pragma omp target
16159 #pragma omp teams distribute parallel for
16160   for (int i = 0; i < 10; ++i) {
16161 #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?}}
16162     for (int i = 0; i < 10; ++i)
16163       ;
16164   }
16165 #pragma omp target
16166 #pragma omp teams distribute parallel for
16167   for (int i = 0; i < 10; ++i) {
16168 #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?}}
16169     for (int i = 0; i < 10; ++i)
16170       ;
16171   }
16172 #pragma omp target
16173 #pragma omp teams distribute parallel for
16174   for (int i = 0; i < 10; ++i) {
16175 #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?}}
16176     for (int i = 0; i < 10; ++i)
16177       ;
16178   }
16179 #pragma omp target
16180 #pragma omp teams distribute parallel for
16181   for (int i = 0; i < 10; ++i) {
16182 #pragma omp simd // OK
16183     for (int i = 0; i < 10; ++i)
16184       ;
16185   }
16186 #pragma omp target
16187 #pragma omp teams distribute parallel for
16188   for (int i = 0; i < 10; ++i) {
16189 #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?}}
16190     for (int i = 0; i < 10; ++i)
16191       ;
16192   }
16193 #pragma omp target
16194 #pragma omp teams distribute parallel for
16195   for (int i = 0; i < 10; ++i) {
16196 #pragma omp parallel // OK
16197     for (int i = 0; i < 10; ++i)
16198       ;
16199   }
16200 #pragma omp target
16201 #pragma omp teams distribute parallel for
16202   for (int i = 0; i < 10; ++i) {
16203 #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?}}
16204     {
16205       bar();
16206     }
16207   }
16208 #pragma omp target
16209 #pragma omp teams distribute parallel for
16210   for (int i = 0; i < 10; ++i) {
16211 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a teams distribute parallel for region}}
16212     {
16213       bar();
16214     }
16215   }
16216 #pragma omp target
16217 #pragma omp teams distribute parallel for
16218   for (int i = 0; i < 10; ++i) {
16219 #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?}}
16220     {
16221       bar();
16222     }
16223   }
16224 #pragma omp target
16225 #pragma omp teams distribute parallel for
16226   for (int i = 0; i < 10; ++i) {
16227 #pragma omp master // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region}}
16228     {
16229       bar();
16230     }
16231   }
16232 #pragma omp target
16233 #pragma omp teams distribute parallel for
16234   for (int i = 0; i < 10; ++i) {
16235 #pragma omp critical // OK
16236     {
16237       bar();
16238     }
16239   }
16240 #pragma omp target
16241 #pragma omp teams distribute parallel for
16242   for (int i = 0; i < 10; ++i) {
16243 #pragma omp parallel // OK
16244     {
16245 #pragma omp single
16246       {
16247 	bar();
16248       }
16249     }
16250   }
16251 #pragma omp target
16252 #pragma omp teams distribute parallel for
16253   for (int i = 0; i < 10; ++i) {
16254 #pragma omp parallel for // OK
16255     for (int i = 0; i < 10; ++i)
16256       ;
16257   }
16258 #pragma omp target
16259 #pragma omp teams distribute parallel for
16260   for (int i = 0; i < 10; ++i) {
16261 #pragma omp parallel for simd // OK
16262     for (int i = 0; i < 10; ++i)
16263       ;
16264   }
16265 #pragma omp target
16266 #pragma omp teams distribute parallel for
16267   for (int i = 0; i < 10; ++i) {
16268 #pragma omp parallel sections // OK
16269     {
16270       bar();
16271     }
16272   }
16273 #pragma omp target
16274 #pragma omp teams distribute parallel for
16275   for (int i = 0; i < 10; ++i) {
16276 #pragma omp task // OK
16277     {
16278       bar();
16279     }
16280   }
16281 #pragma omp target
16282 #pragma omp teams distribute parallel for
16283   for (int i = 0; i < 10; ++i) {
16284 #pragma omp taskyield // OK
16285     bar();
16286   }
16287 #pragma omp target
16288 #pragma omp teams distribute parallel for
16289   for (int i = 0; i < 10; ++i) {
16290 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'teams distribute parallel for' region}}
16291     bar();
16292   }
16293 #pragma omp target
16294 #pragma omp teams distribute parallel for
16295   for (int i = 0; i < 10; ++i) {
16296 #pragma omp taskwait // OK
16297     bar();
16298   }
16299 #pragma omp target
16300 #pragma omp teams distribute parallel for
16301   for (int i = 0; i < 10; ++i) {
16302 #pragma omp flush // OK
16303     bar();
16304   }
16305 #pragma omp target
16306 #pragma omp teams distribute parallel for
16307   for (int i = 0; i < 10; ++i) {
16308 #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?}}
16309     bar();
16310   }
16311 #pragma omp target
16312 #pragma omp teams distribute parallel for
16313   for (int i = 0; i < 10; ++i) {
16314 #pragma omp atomic // OK
16315     ++a;
16316   }
16317 #pragma omp target
16318 #pragma omp teams distribute parallel for
16319   for (int i = 0; i < 10; ++i) {
16320 #pragma omp target // expected-error {{region cannot be nested inside 'target' region}}
16321     ++a;
16322   }
16323 #pragma omp target
16324 #pragma omp teams distribute parallel for
16325   for (int i = 0; i < 10; ++i) {
16326 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target' region}}
16327     ++a;
16328   }
16329 #pragma omp target
16330 #pragma omp teams distribute parallel for
16331   for (int i = 0; i < 10; ++i) {
16332 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target' region}}
16333     for (int i = 0; i < 10; ++i)
16334       ;
16335   }
16336 #pragma omp target
16337 #pragma omp teams distribute parallel for
16338   for (int i = 0; i < 10; ++i) {
16339 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target' region}}
16340     ++a;
16341   }
16342 #pragma omp target
16343 #pragma omp teams distribute parallel for
16344   for (int i = 0; i < 10; ++i) {
16345 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target' region}}
16346     ++a;
16347   }
16348 #pragma omp target
16349 #pragma omp teams distribute parallel for
16350   for (int i = 0; i < 10; ++i) {
16351 #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?}}
16352     ++a;
16353   }
16354 #pragma omp target
16355 #pragma omp teams distribute parallel for
16356   for (int i = 0; i < 10; ++i) {
16357 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target' region}}
16358     ++a;
16359   }
16360 #pragma omp target
16361 #pragma omp teams distribute parallel for
16362   for (int i = 0; i < 10; ++i) {
16363 #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?}}
16364     for (int i = 0; i < 10; ++i)
16365       ++a;
16366   }
16367 #pragma omp target
16368 #pragma omp teams distribute parallel for
16369   for (int i = 0; i < 10; ++i) {
16370 #pragma omp target simd // expected-error {{region cannot be nested inside 'target' region}}
16371     for (int i = 0; i < 10; ++i)
16372       ++a;
16373   }
16374 #pragma omp target
16375 #pragma omp teams distribute parallel for
16376   for (int i = 0; i < 10; ++i) {
16377 #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?}}
16378     for (int i = 0; i < 10; ++i)
16379       ++a;
16380   }
16381 #pragma omp target
16382 #pragma omp teams distribute parallel for
16383   for (int i = 0; i < 10; ++i) {
16384 #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?}}
16385     for (int i = 0; i < 10; ++i)
16386       ++a;
16387   }
16388 #pragma omp target
16389 #pragma omp teams distribute parallel for
16390   for (int i = 0; i < 10; ++i) {
16391 #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?}}
16392     for (int i = 0; i < 10; ++i)
16393       ++a;
16394   }
16395 #pragma omp target
16396 #pragma omp teams distribute parallel for
16397   for (int i = 0; i < 10; ++i) {
16398 #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?}}
16399     for (int i = 0; i < 10; ++i)
16400       ++a;
16401   }
16402 #pragma omp target
16403 #pragma omp teams distribute parallel for
16404   for (int i = 0; i < 10; ++i) {
16405 #pragma omp target teams // expected-error {{region cannot be nested inside 'target' region}}
16406     ++a;
16407   }
16408 #pragma omp target
16409 #pragma omp teams distribute parallel for
16410   for (int i = 0; i < 10; ++i) {
16411 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target' region}}
16412     for (int i = 0; i < 10; ++i)
16413       ++a;
16414   }
16415 #pragma omp target
16416 #pragma omp teams distribute parallel for
16417   for (int i = 0; i < 10; ++i) {
16418 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target' region}}
16419     for (int i = 0; i < 10; ++i)
16420       ++a;
16421   }
16422 #pragma omp target
16423 #pragma omp teams distribute parallel for
16424   for (int i = 0; i < 10; ++i) {
16425 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target' region}}
16426     for (int i = 0; i < 10; ++i)
16427       ++a;
16428   }
16429 #pragma omp target
16430 #pragma omp teams distribute parallel for
16431   for (int i = 0; i < 10; ++i) {
16432 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target' region}}
16433     for (int i = 0; i < 10; ++i)
16434       ++a;
16435   }
16436 
16437 // TARGET TEAMS DIRECTIVE
16438 #pragma omp target teams
16439 #pragma omp parallel
16440   bar();
16441 #pragma omp target teams
16442 #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?}}
16443   for (int i = 0; i < 10; ++i)
16444     ;
16445 #pragma omp target teams
16446 #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?}}
16447   for (int i = 0; i < 10; ++i)
16448     ;
16449 #pragma omp target teams
16450 #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?}}
16451   for (int i = 0; i < 10; ++i)
16452     ;
16453 #pragma omp target teams
16454 #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?}}
16455   {
16456     bar();
16457   }
16458 #pragma omp target teams
16459 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams region}}
16460   {
16461     bar();
16462   }
16463 #pragma omp target teams
16464 #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?}}
16465   bar();
16466 
16467 #pragma omp target teams
16468 #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?}}
16469   {
16470     bar();
16471   }
16472 #pragma omp target teams
16473 #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?}}
16474   {
16475     bar();
16476   }
16477 #pragma omp target teams
16478 #pragma omp parallel for
16479   for (int i = 0; i < 10; ++i)
16480     ;
16481 #pragma omp target teams
16482 #pragma omp parallel for simd
16483   for (int i = 0; i < 10; ++i)
16484     ;
16485 #pragma omp target teams
16486 #pragma omp parallel sections
16487   {
16488     bar();
16489   }
16490 #pragma omp target teams
16491 #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?}}
16492   {
16493     bar();
16494   }
16495 #pragma omp target teams
16496   {
16497 #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?}}
16498     bar();
16499   }
16500 #pragma omp target teams
16501   {
16502 #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?}}
16503     bar();
16504   }
16505 #pragma omp target teams
16506   {
16507 #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?}}
16508     bar();
16509   }
16510 #pragma omp target teams
16511   {
16512 #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?}}
16513     bar();
16514   }
16515 #pragma omp target teams
16516   {
16517 #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?}}
16518     bar();
16519   }
16520 #pragma omp target teams
16521   {
16522 #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?}}
16523     ++a;
16524   }
16525 #pragma omp target teams
16526   {
16527 #pragma omp target // expected-error {{region cannot be nested inside 'target teams' region}}
16528     ++a;
16529   }
16530 #pragma omp target teams
16531   {
16532 #pragma omp target parallel // expected-error {{region cannot be nested inside 'target teams' region}}
16533     ++a;
16534   }
16535 #pragma omp target teams
16536 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams' region}}
16537   for (int i = 0; i < 10; ++i)
16538     ;
16539 #pragma omp target teams
16540   {
16541 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams' region}}
16542   }
16543 #pragma omp target teams
16544   {
16545 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams' region}}
16546   }
16547 #pragma omp target teams
16548   {
16549 #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?}}
16550     ++a;
16551   }
16552 #pragma omp target teams
16553   {
16554 #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?}}
16555   for (int i = 0; i < 10; ++i)
16556     ++a;
16557   }
16558 #pragma omp target teams
16559 #pragma omp distribute
16560   for (int i = 0; i < 10; ++i)
16561     ;
16562 #pragma omp target teams
16563   {
16564 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams' region}}
16565     ++a;
16566   }
16567 #pragma omp target teams
16568 #pragma omp distribute parallel for
16569   for (int i = 0; i < 10; ++i)
16570     ;
16571 #pragma omp target teams
16572   {
16573 #pragma omp distribute parallel for
16574   for (int i = 0; i < 10; ++i)
16575     ;
16576 #pragma omp distribute parallel for
16577   for (int j = 0; j < 10; ++j)
16578     ;
16579   }
16580 #pragma omp target teams
16581   {
16582 #pragma omp distribute parallel for simd
16583   for (int i = 0; i < 10; ++i)
16584     ;
16585 #pragma omp distribute parallel for simd
16586   for (int j = 0; j < 10; ++j)
16587     ;
16588   }
16589 #pragma omp target teams
16590   {
16591 #pragma omp distribute simd
16592   for (int i = 0; i < 10; ++i)
16593     ;
16594 #pragma omp distribute simd
16595   for (int j = 0; j < 10; ++j)
16596     ;
16597   }
16598 #pragma omp target teams
16599   {
16600 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams' region}}
16601   for (int i = 0; i < 10; ++i)
16602     ;
16603   }
16604 #pragma omp target teams
16605   {
16606 #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?}}
16607   for (int i = 0; i < 10; ++i)
16608     ;
16609   }
16610 #pragma omp target teams
16611   {
16612 #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?}}
16613   for (int i = 0; i < 10; ++i)
16614     ;
16615   }
16616 #pragma omp target teams
16617   {
16618 #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?}}
16619   for (int i = 0; i < 10; ++i)
16620     ;
16621   }
16622 #pragma omp target teams
16623   {
16624 #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?}}
16625   for (int i = 0; i < 10; ++i)
16626     ;
16627   }
16628 #pragma omp target teams
16629   {
16630 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams' region}}
16631     a++;
16632   }
16633 #pragma omp target teams
16634   {
16635 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams' region}}
16636   for (int i = 0; i < 10; ++i)
16637     ;
16638   }
16639 #pragma omp target teams
16640   {
16641 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams' region}}
16642   for (int i = 0; i < 10; ++i)
16643     ;
16644   }
16645 #pragma omp target teams
16646   {
16647 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams' region}}
16648   for (int i = 0; i < 10; ++i)
16649     ;
16650   }
16651 #pragma omp target teams
16652   {
16653 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams' region}}
16654   for (int i = 0; i < 10; ++i)
16655     ;
16656   }
16657 
16658 // TARGET TEAMS DISTRIBUTE DIRECTIVE
16659 #pragma omp target teams distribute // OK
16660   for (int i = 0; i < 10; ++i)
16661     ;
16662 #pragma omp target teams distribute
16663   for (int i = 0; i < 10; ++i) {
16664 #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?}}
16665     for (int i = 0; i < 10; ++i)
16666       ;
16667   }
16668 #pragma omp target teams distribute
16669   for (int i = 0; i < 10; ++i) {
16670 #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?}}
16671     for (int i = 0; i < 10; ++i)
16672       ;
16673   }
16674 #pragma omp target teams distribute
16675   for (int i = 0; i < 10; ++i) {
16676 #pragma omp for // OK
16677     for (int i = 0; i < 10; ++i)
16678       ;
16679   }
16680 #pragma omp target teams distribute
16681   for (int i = 0; i < 10; ++i) {
16682 #pragma omp simd // OK
16683     for (int i = 0; i < 10; ++i)
16684       ;
16685   }
16686 #pragma omp target teams distribute
16687   for (int i = 0; i < 10; ++i) {
16688 #pragma omp for simd // OK
16689     for (int i = 0; i < 10; ++i)
16690       ;
16691   }
16692 #pragma omp target teams distribute
16693   for (int i = 0; i < 10; ++i) {
16694 #pragma omp parallel // OK
16695     for (int i = 0; i < 10; ++i)
16696       ;
16697   }
16698 #pragma omp target teams distribute
16699   for (int i = 0; i < 10; ++i) {
16700 #pragma omp sections // OK
16701     {
16702       bar();
16703     }
16704   }
16705 #pragma omp target teams distribute
16706   for (int i = 0; i < 10; ++i) {
16707 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams distribute region}}
16708     {
16709       bar();
16710     }
16711   }
16712 #pragma omp target teams distribute
16713   for (int i = 0; i < 10; ++i) {
16714 #pragma omp single // OK
16715     {
16716       bar();
16717     }
16718   }
16719 #pragma omp target teams distribute
16720   for (int i = 0; i < 10; ++i) {
16721 #pragma omp master // OK
16722     {
16723       bar();
16724     }
16725   }
16726 #pragma omp target teams distribute
16727   for (int i = 0; i < 10; ++i) {
16728 #pragma omp critical // OK
16729     {
16730       bar();
16731     }
16732   }
16733 #pragma omp target teams distribute
16734   for (int i = 0; i < 10; ++i) {
16735 #pragma omp parallel // OK
16736     {
16737 #pragma omp single
16738       {
16739 	bar();
16740       }
16741     }
16742   }
16743 #pragma omp target teams distribute
16744   for (int i = 0; i < 10; ++i) {
16745 #pragma omp parallel for // OK
16746     for (int i = 0; i < 10; ++i)
16747       ;
16748   }
16749 #pragma omp target teams distribute
16750   for (int i = 0; i < 10; ++i) {
16751 #pragma omp parallel for simd // OK
16752     for (int i = 0; i < 10; ++i)
16753       ;
16754   }
16755 #pragma omp target teams distribute
16756   for (int i = 0; i < 10; ++i) {
16757 #pragma omp parallel sections // OK
16758     {
16759       bar();
16760     }
16761   }
16762 #pragma omp target teams distribute
16763   for (int i = 0; i < 10; ++i) {
16764 #pragma omp task // OK
16765     {
16766       bar();
16767     }
16768   }
16769 #pragma omp target teams distribute
16770   for (int i = 0; i < 10; ++i) {
16771 #pragma omp taskyield // OK
16772     bar();
16773   }
16774 #pragma omp target teams distribute
16775   for (int i = 0; i < 10; ++i) {
16776 #pragma omp barrier // OK
16777     bar();
16778   }
16779 #pragma omp target teams distribute
16780   for (int i = 0; i < 10; ++i) {
16781 #pragma omp taskwait // OK
16782     bar();
16783   }
16784 #pragma omp target teams distribute
16785   for (int i = 0; i < 10; ++i) {
16786 #pragma omp flush // OK
16787     bar();
16788   }
16789 #pragma omp target teams distribute
16790   for (int i = 0; i < 10; ++i) {
16791 #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?}}
16792     bar();
16793   }
16794 #pragma omp target teams distribute
16795   for (int i = 0; i < 10; ++i) {
16796 #pragma omp atomic // OK
16797     ++a;
16798   }
16799 #pragma omp target teams distribute
16800   for (int i = 0; i < 10; ++i) {
16801 #pragma omp target // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16802     ++a;
16803   }
16804 #pragma omp target teams distribute
16805   for (int i = 0; i < 10; ++i) {
16806 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16807     ++a;
16808   }
16809 #pragma omp target teams distribute
16810   for (int i = 0; i < 10; ++i) {
16811 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16812     for (int i = 0; i < 10; ++i)
16813       ;
16814   }
16815 #pragma omp target teams distribute
16816   for (int i = 0; i < 10; ++i) {
16817 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16818     ++a;
16819   }
16820 #pragma omp target teams distribute
16821   for (int i = 0; i < 10; ++i) {
16822 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16823     ++a;
16824   }
16825 #pragma omp target teams distribute
16826   for (int i = 0; i < 10; ++i) {
16827 #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?}}
16828     ++a;
16829   }
16830 #pragma omp target teams distribute
16831   for (int i = 0; i < 10; ++i) {
16832 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16833     ++a;
16834   }
16835 #pragma omp target teams distribute
16836   for (int i = 0; i < 10; ++i) {
16837 #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?}}
16838     for (int i = 0; i < 10; ++i)
16839       ++a;
16840   }
16841 #pragma omp target teams distribute
16842   for (int i = 0; i < 10; ++i) {
16843 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16844     for (int i = 0; i < 10; ++i)
16845       ++a;
16846   }
16847 #pragma omp target teams distribute
16848   for (int i = 0; i < 10; ++i) {
16849 #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?}}
16850     for (int i = 0; i < 10; ++i)
16851       ++a;
16852   }
16853 #pragma omp target teams distribute
16854   for (int i = 0; i < 10; ++i) {
16855 #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?}}
16856     for (int i = 0; i < 10; ++i)
16857       ++a;
16858   }
16859 #pragma omp target teams distribute
16860   for (int i = 0; i < 10; ++i) {
16861 #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?}}
16862     for (int i = 0; i < 10; ++i)
16863       ++a;
16864   }
16865 #pragma omp target teams distribute
16866   for (int i = 0; i < 10; ++i) {
16867 #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?}}
16868     for (int i = 0; i < 10; ++i)
16869       ++a;
16870   }
16871 #pragma omp target teams distribute
16872   for (int i = 0; i < 10; ++i) {
16873 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16874     ++a;
16875   }
16876 #pragma omp target teams distribute
16877   for (int i = 0; i < 10; ++i) {
16878 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16879     for (int i = 0; i < 10; ++i)
16880       ++a;
16881   }
16882 #pragma omp target teams distribute
16883   for (int i = 0; i < 10; ++i) {
16884 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16885     for (int i = 0; i < 10; ++i)
16886       ++a;
16887   }
16888 #pragma omp target teams distribute
16889   for (int i = 0; i < 10; ++i) {
16890 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16891     for (int i = 0; i < 10; ++i)
16892       ++a;
16893   }
16894 #pragma omp target teams distribute
16895   for (int i = 0; i < 10; ++i) {
16896 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams distribute' region}}
16897     for (int i = 0; i < 10; ++i)
16898       ++a;
16899   }
16900 
16901 // TARGET TEAMS DISTRIBUTE PARALLEL FOR DIRECTIVE
16902 #pragma omp target teams distribute parallel for // OK
16903   for (int i = 0; i < 10; ++i)
16904     ;
16905 #pragma omp target teams distribute parallel for
16906   for (int i = 0; i < 10; ++i) {
16907 #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?}}
16908     for (int i = 0; i < 10; ++i)
16909       ;
16910   }
16911 #pragma omp target teams distribute parallel for
16912   for (int i = 0; i < 10; ++i) {
16913 #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?}}
16914     for (int i = 0; i < 10; ++i)
16915       ;
16916   }
16917 #pragma omp target teams distribute parallel for
16918   for (int i = 0; i < 10; ++i) {
16919 #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?}}
16920     for (int i = 0; i < 10; ++i)
16921       ;
16922   }
16923 #pragma omp target teams distribute parallel for
16924   for (int i = 0; i < 10; ++i) {
16925 #pragma omp simd // OK
16926     for (int i = 0; i < 10; ++i)
16927       ;
16928   }
16929 #pragma omp target teams distribute parallel for
16930   for (int i = 0; i < 10; ++i) {
16931 #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?}}
16932     for (int i = 0; i < 10; ++i)
16933       ;
16934   }
16935 #pragma omp target teams distribute parallel for
16936   for (int i = 0; i < 10; ++i) {
16937 #pragma omp parallel // OK
16938     for (int i = 0; i < 10; ++i)
16939       ;
16940   }
16941 #pragma omp target teams distribute parallel for
16942   for (int i = 0; i < 10; ++i) {
16943 #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?}}
16944     {
16945       bar();
16946     }
16947   }
16948 #pragma omp target teams distribute parallel for
16949   for (int i = 0; i < 10; ++i) {
16950 #pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a target teams distribute parallel for region}}
16951     {
16952       bar();
16953     }
16954   }
16955 #pragma omp target teams distribute parallel for
16956   for (int i = 0; i < 10; ++i) {
16957 #pragma omp single // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
16958     {
16959       bar();
16960     }
16961   }
16962 #pragma omp target teams distribute parallel for
16963   for (int i = 0; i < 10; ++i) {
16964 #pragma omp master // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
16965     {
16966       bar();
16967     }
16968   }
16969 #pragma omp target teams distribute parallel for
16970   for (int i = 0; i < 10; ++i) {
16971 #pragma omp critical // OK
16972     {
16973       bar();
16974     }
16975   }
16976 #pragma omp target teams distribute parallel for
16977   for (int i = 0; i < 10; ++i) {
16978 #pragma omp parallel // OK
16979     {
16980 #pragma omp single
16981       {
16982 	bar();
16983       }
16984     }
16985   }
16986 #pragma omp target teams distribute parallel for
16987   for (int i = 0; i < 10; ++i) {
16988 #pragma omp parallel for // OK
16989     for (int i = 0; i < 10; ++i)
16990       ;
16991   }
16992 #pragma omp target teams distribute parallel for
16993   for (int i = 0; i < 10; ++i) {
16994 #pragma omp parallel for simd // OK
16995     for (int i = 0; i < 10; ++i)
16996       ;
16997   }
16998 #pragma omp target teams distribute parallel for
16999   for (int i = 0; i < 10; ++i) {
17000 #pragma omp parallel sections // OK
17001     {
17002       bar();
17003     }
17004   }
17005 #pragma omp target teams distribute parallel for
17006   for (int i = 0; i < 10; ++i) {
17007 #pragma omp task // OK
17008     {
17009       bar();
17010     }
17011   }
17012 #pragma omp target teams distribute parallel for
17013   for (int i = 0; i < 10; ++i) {
17014 #pragma omp taskyield // OK
17015     bar();
17016   }
17017 #pragma omp target teams distribute parallel for
17018   for (int i = 0; i < 10; ++i) {
17019 #pragma omp barrier // expected-error {{region cannot be closely nested inside 'target teams distribute parallel for' region}}
17020     bar();
17021   }
17022 #pragma omp target teams distribute parallel for
17023   for (int i = 0; i < 10; ++i) {
17024 #pragma omp taskwait // OK
17025     bar();
17026   }
17027 #pragma omp target teams distribute parallel for
17028   for (int i = 0; i < 10; ++i) {
17029 #pragma omp flush // OK
17030     bar();
17031   }
17032 #pragma omp target teams distribute parallel for
17033   for (int i = 0; i < 10; ++i) {
17034 #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?}}
17035     bar();
17036   }
17037 #pragma omp target teams distribute parallel for
17038   for (int i = 0; i < 10; ++i) {
17039 #pragma omp atomic // OK
17040     ++a;
17041   }
17042 #pragma omp target teams distribute parallel for
17043   for (int i = 0; i < 10; ++i) {
17044 #pragma omp target // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17045     ++a;
17046   }
17047 #pragma omp target teams distribute parallel for
17048   for (int i = 0; i < 10; ++i) {
17049 #pragma omp target parallel  // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17050     ++a;
17051   }
17052 #pragma omp target teams distribute parallel for
17053   for (int i = 0; i < 10; ++i) {
17054 #pragma omp target parallel for // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17055     for (int i = 0; i < 10; ++i)
17056       ;
17057   }
17058 #pragma omp target teams distribute parallel for
17059   for (int i = 0; i < 10; ++i) {
17060 #pragma omp target enter data map(to: a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17061     ++a;
17062   }
17063 #pragma omp target teams distribute parallel for
17064   for (int i = 0; i < 10; ++i) {
17065 #pragma omp target exit data map(from: a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17066     ++a;
17067   }
17068 #pragma omp target teams distribute parallel for
17069   for (int i = 0; i < 10; ++i) {
17070 #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?}}
17071     ++a;
17072   }
17073 #pragma omp target teams distribute parallel for
17074   for (int i = 0; i < 10; ++i) {
17075 #pragma omp target update to(a) // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17076     ++a;
17077   }
17078 #pragma omp target teams distribute parallel for
17079   for (int i = 0; i < 10; ++i) {
17080 #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?}}
17081     for (int i = 0; i < 10; ++i)
17082       ++a;
17083   }
17084 #pragma omp target teams distribute parallel for
17085   for (int i = 0; i < 10; ++i) {
17086 #pragma omp target simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17087     for (int i = 0; i < 10; ++i)
17088       ++a;
17089   }
17090 #pragma omp target teams distribute parallel for
17091   for (int i = 0; i < 10; ++i) {
17092 #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?}}
17093     for (int i = 0; i < 10; ++i)
17094       ++a;
17095   }
17096 #pragma omp target teams distribute parallel for
17097   for (int i = 0; i < 10; ++i) {
17098 #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?}}
17099     for (int i = 0; i < 10; ++i)
17100       ++a;
17101   }
17102 #pragma omp target teams distribute parallel for
17103   for (int i = 0; i < 10; ++i) {
17104 #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?}}
17105     for (int i = 0; i < 10; ++i)
17106       ++a;
17107   }
17108 #pragma omp target teams distribute parallel for
17109   for (int i = 0; i < 10; ++i) {
17110 #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?}}
17111     for (int i = 0; i < 10; ++i)
17112       ++a;
17113   }
17114 #pragma omp target teams distribute parallel for
17115   for (int i = 0; i < 10; ++i) {
17116 #pragma omp target teams // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17117     ++a;
17118   }
17119 #pragma omp target teams distribute parallel for
17120   for (int i = 0; i < 10; ++i) {
17121 #pragma omp target teams distribute // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17122     for (int i = 0; i < 10; ++i)
17123       ++a;
17124   }
17125 #pragma omp target teams distribute parallel for
17126   for (int i = 0; i < 10; ++i) {
17127 #pragma omp target teams distribute parallel for // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17128     for (int i = 0; i < 10; ++i)
17129       ++a;
17130   }
17131 #pragma omp target teams distribute parallel for
17132   for (int i = 0; i < 10; ++i) {
17133 #pragma omp target teams distribute parallel for simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17134     for (int i = 0; i < 10; ++i)
17135       ++a;
17136   }
17137 #pragma omp target teams distribute parallel for
17138   for (int i = 0; i < 10; ++i) {
17139 #pragma omp target teams distribute simd // expected-error {{region cannot be nested inside 'target teams distribute parallel for' region}}
17140     for (int i = 0; i < 10; ++i)
17141       ++a;
17142   }
17143 
17144 // TARGET TEAMS DISTRIBUTE PARALLEL FOR SIMD DIRECTIVE
17145 #pragma omp target teams distribute parallel for simd // OK
17146   for (int i = 0; i < 10; ++i)
17147     ;
17148 #pragma omp target teams distribute parallel for simd
17149   for (int i = 0; i < 10; ++i) {
17150 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17151     for (int i = 0; i < 10; ++i)
17152       ;
17153   }
17154 #pragma omp target teams distribute parallel for simd
17155   for (int i = 0; i < 10; ++i) {
17156 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17157     for (int i = 0; i < 10; ++i)
17158       ;
17159   }
17160 #pragma omp target teams distribute parallel for simd
17161   for (int i = 0; i < 10; ++i) {
17162 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17163     for (int i = 0; i < 10; ++i)
17164       ;
17165   }
17166 #pragma omp target teams distribute parallel for simd
17167   for (int i = 0; i < 10; ++i) {
17168 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
17169     for (int i = 0; i < 10; ++i)
17170       ;
17171   }
17172 #pragma omp target teams distribute parallel for simd
17173   for (int i = 0; i < 10; ++i) {
17174 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17175     for (int i = 0; i < 10; ++i)
17176       ;
17177   }
17178 #pragma omp target teams distribute parallel for simd
17179   for (int i = 0; i < 10; ++i) {
17180 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17181     for (int i = 0; i < 10; ++i)
17182       ;
17183   }
17184 #pragma omp target teams distribute parallel for simd
17185   for (int i = 0; i < 10; ++i) {
17186 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17187     {
17188       bar();
17189     }
17190   }
17191 #pragma omp target teams distribute parallel for simd
17192   for (int i = 0; i < 10; ++i) {
17193 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17194     {
17195       bar();
17196     }
17197   }
17198 #pragma omp target teams distribute parallel for simd
17199   for (int i = 0; i < 10; ++i) {
17200 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17201     {
17202       bar();
17203     }
17204   }
17205 #pragma omp target teams distribute parallel for simd
17206   for (int i = 0; i < 10; ++i) {
17207 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17208     {
17209       bar();
17210     }
17211   }
17212 #pragma omp target teams distribute parallel for simd
17213   for (int i = 0; i < 10; ++i) {
17214 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17215     {
17216       bar();
17217     }
17218   }
17219 #pragma omp target teams distribute parallel for simd
17220   for (int i = 0; i < 10; ++i) {
17221 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17222     {
17223 #pragma omp single
17224       {
17225 	bar();
17226       }
17227     }
17228   }
17229 #pragma omp target teams distribute parallel for simd
17230   for (int i = 0; i < 10; ++i) {
17231 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17232     for (int i = 0; i < 10; ++i)
17233       ;
17234   }
17235 #pragma omp target teams distribute parallel for simd
17236   for (int i = 0; i < 10; ++i) {
17237 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17238     for (int i = 0; i < 10; ++i)
17239       ;
17240   }
17241 #pragma omp target teams distribute parallel for simd
17242   for (int i = 0; i < 10; ++i) {
17243 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17244     {
17245       bar();
17246     }
17247   }
17248 #pragma omp target teams distribute parallel for simd
17249   for (int i = 0; i < 10; ++i) {
17250 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17251     {
17252       bar();
17253     }
17254   }
17255 #pragma omp target teams distribute parallel for simd
17256   for (int i = 0; i < 10; ++i) {
17257 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17258     bar();
17259   }
17260 #pragma omp target teams distribute parallel for simd
17261   for (int i = 0; i < 10; ++i) {
17262 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17263     bar();
17264   }
17265 #pragma omp target teams distribute parallel for simd
17266   for (int i = 0; i < 10; ++i) {
17267 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17268     bar();
17269   }
17270 #pragma omp target teams distribute parallel for simd
17271   for (int i = 0; i < 10; ++i) {
17272 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17273     bar();
17274   }
17275 #pragma omp target teams distribute parallel for simd
17276   for (int i = 0; i < 10; ++i) {
17277 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17278     bar();
17279   }
17280 #pragma omp target teams distribute parallel for simd
17281   for (int i = 0; i < 10; ++i) {
17282 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}OK
17283     ++a;
17284   }
17285 #pragma omp target teams distribute parallel for simd
17286   for (int i = 0; i < 10; ++i) {
17287 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17288     ++a;
17289   }
17290 #pragma omp target teams distribute parallel for simd
17291   for (int i = 0; i < 10; ++i) {
17292 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17293     ++a;
17294   }
17295 #pragma omp target teams distribute parallel for simd
17296   for (int i = 0; i < 10; ++i) {
17297 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17298     for (int i = 0; i < 10; ++i)
17299       ;
17300   }
17301 #pragma omp target teams distribute parallel for simd
17302   for (int i = 0; i < 10; ++i) {
17303 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17304     ++a;
17305   }
17306 #pragma omp target teams distribute parallel for simd
17307   for (int i = 0; i < 10; ++i) {
17308 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17309     ++a;
17310   }
17311 #pragma omp target teams distribute parallel for simd
17312   for (int i = 0; i < 10; ++i) {
17313 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17314     ++a;
17315   }
17316 #pragma omp target teams distribute parallel for simd
17317   for (int i = 0; i < 10; ++i) {
17318 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17319     ++a;
17320   }
17321 #pragma omp target teams distribute parallel for simd
17322   for (int i = 0; i < 10; ++i) {
17323 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17324     for (int i = 0; i < 10; ++i)
17325       ++a;
17326   }
17327 #pragma omp target teams distribute parallel for simd
17328   for (int i = 0; i < 10; ++i) {
17329 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17330     for (int i = 0; i < 10; ++i)
17331       ++a;
17332   }
17333 #pragma omp target teams distribute parallel for simd
17334   for (int i = 0; i < 10; ++i) {
17335 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17336     for (int i = 0; i < 10; ++i)
17337       ++a;
17338   }
17339 #pragma omp target teams distribute parallel for simd
17340   for (int i = 0; i < 10; ++i) {
17341 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17342     for (int i = 0; i < 10; ++i)
17343       ++a;
17344   }
17345 #pragma omp target teams distribute parallel for simd
17346   for (int i = 0; i < 10; ++i) {
17347 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17348     for (int i = 0; i < 10; ++i)
17349       ++a;
17350   }
17351 #pragma omp target teams distribute parallel for simd
17352   for (int i = 0; i < 10; ++i) {
17353 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17354     for (int i = 0; i < 10; ++i)
17355       ;
17356   }
17357 #pragma omp target teams distribute parallel for simd
17358   for (int i = 0; i < 10; ++i) {
17359 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17360     a++;
17361   }
17362 #pragma omp target teams distribute parallel for simd
17363   for (int i = 0; i < 10; ++i) {
17364 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17365     for (int i = 0; i < 10; ++i)
17366       ;
17367   }
17368 #pragma omp target teams distribute parallel for simd
17369   for (int i = 0; i < 10; ++i) {
17370 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17371     for (int i = 0; i < 10; ++i)
17372       ;
17373   }
17374 #pragma omp target teams distribute parallel for simd
17375   for (int i = 0; i < 10; ++i) {
17376 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17377     for (int i = 0; i < 10; ++i)
17378       ;
17379   }
17380 #pragma omp target teams distribute parallel for simd
17381   for (int i = 0; i < 10; ++i) {
17382 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17383     for (int i = 0; i < 10; ++i)
17384       ;
17385   }
17386 
17387 // TARGET TEAMS DISTRIBUTE SIMD DIRECTIVE
17388 #pragma omp target teams distribute simd // OK
17389   for (int i = 0; i < 10; ++i)
17390     ;
17391 #pragma omp target teams distribute simd
17392   for (int i = 0; i < 10; ++i) {
17393 #pragma omp distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17394     for (int i = 0; i < 10; ++i)
17395       ;
17396   }
17397 #pragma omp target teams distribute simd
17398   for (int i = 0; i < 10; ++i) {
17399 #pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17400     for (int i = 0; i < 10; ++i)
17401       ;
17402   }
17403 #pragma omp target teams distribute simd
17404   for (int i = 0; i < 10; ++i) {
17405 #pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17406     for (int i = 0; i < 10; ++i)
17407       ;
17408   }
17409 #pragma omp target teams distribute simd
17410   for (int i = 0; i < 10; ++i) {
17411 #pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}}
17412     for (int i = 0; i < 10; ++i)
17413       ;
17414   }
17415 #pragma omp target teams distribute simd
17416   for (int i = 0; i < 10; ++i) {
17417 #pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17418     for (int i = 0; i < 10; ++i)
17419       ;
17420   }
17421 #pragma omp target teams distribute simd
17422   for (int i = 0; i < 10; ++i) {
17423 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17424     for (int i = 0; i < 10; ++i)
17425       ;
17426   }
17427 #pragma omp target teams distribute simd
17428   for (int i = 0; i < 10; ++i) {
17429 #pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17430     {
17431       bar();
17432     }
17433   }
17434 #pragma omp target teams distribute simd
17435   for (int i = 0; i < 10; ++i) {
17436 #pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17437     {
17438       bar();
17439     }
17440   }
17441 #pragma omp target teams distribute simd
17442   for (int i = 0; i < 10; ++i) {
17443 #pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17444     {
17445       bar();
17446     }
17447   }
17448 #pragma omp target teams distribute simd
17449   for (int i = 0; i < 10; ++i) {
17450 #pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17451     {
17452       bar();
17453     }
17454   }
17455 #pragma omp target teams distribute simd
17456   for (int i = 0; i < 10; ++i) {
17457 #pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17458     {
17459       bar();
17460     }
17461   }
17462 #pragma omp target teams distribute simd
17463   for (int i = 0; i < 10; ++i) {
17464 #pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17465     {
17466 #pragma omp single
17467       {
17468 	bar();
17469       }
17470     }
17471   }
17472 #pragma omp target teams distribute simd
17473   for (int i = 0; i < 10; ++i) {
17474 #pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17475     for (int i = 0; i < 10; ++i)
17476       ;
17477   }
17478 #pragma omp target teams distribute simd
17479   for (int i = 0; i < 10; ++i) {
17480 #pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17481     for (int i = 0; i < 10; ++i)
17482       ;
17483   }
17484 #pragma omp target teams distribute simd
17485   for (int i = 0; i < 10; ++i) {
17486 #pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17487     {
17488       bar();
17489     }
17490   }
17491 #pragma omp target teams distribute simd
17492   for (int i = 0; i < 10; ++i) {
17493 #pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17494     {
17495       bar();
17496     }
17497   }
17498 #pragma omp target teams distribute simd
17499   for (int i = 0; i < 10; ++i) {
17500 #pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17501     bar();
17502   }
17503 #pragma omp target teams distribute simd
17504   for (int i = 0; i < 10; ++i) {
17505 #pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17506     bar();
17507   }
17508 #pragma omp target teams distribute simd
17509   for (int i = 0; i < 10; ++i) {
17510 #pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17511     bar();
17512   }
17513 #pragma omp target teams distribute simd
17514   for (int i = 0; i < 10; ++i) {
17515 #pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17516     bar();
17517   }
17518 #pragma omp target teams distribute simd
17519   for (int i = 0; i < 10; ++i) {
17520 #pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17521     bar();
17522   }
17523 #pragma omp target teams distribute simd
17524   for (int i = 0; i < 10; ++i) {
17525 #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}OK
17526     ++a;
17527   }
17528 #pragma omp target teams distribute simd
17529   for (int i = 0; i < 10; ++i) {
17530 #pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17531     ++a;
17532   }
17533 #pragma omp target teams distribute simd
17534   for (int i = 0; i < 10; ++i) {
17535 #pragma omp target parallel  // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17536     ++a;
17537   }
17538 #pragma omp target teams distribute simd
17539   for (int i = 0; i < 10; ++i) {
17540 #pragma omp target parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17541     for (int i = 0; i < 10; ++i)
17542       ;
17543   }
17544 #pragma omp target teams distribute simd
17545   for (int i = 0; i < 10; ++i) {
17546 #pragma omp target enter data map(to: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17547     ++a;
17548   }
17549 #pragma omp target teams distribute simd
17550   for (int i = 0; i < 10; ++i) {
17551 #pragma omp target exit data map(from: a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17552     ++a;
17553   }
17554 #pragma omp target teams distribute simd
17555   for (int i = 0; i < 10; ++i) {
17556 #pragma omp teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17557     ++a;
17558   }
17559 #pragma omp target teams distribute simd
17560   for (int i = 0; i < 10; ++i) {
17561 #pragma omp target update to(a) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17562     ++a;
17563   }
17564 #pragma omp target teams distribute simd
17565   for (int i = 0; i < 10; ++i) {
17566 #pragma omp distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17567     for (int i = 0; i < 10; ++i)
17568       ++a;
17569   }
17570 #pragma omp target teams distribute simd
17571   for (int i = 0; i < 10; ++i) {
17572 #pragma omp target simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17573     for (int i = 0; i < 10; ++i)
17574       ++a;
17575   }
17576 #pragma omp target teams distribute simd
17577   for (int i = 0; i < 10; ++i) {
17578 #pragma omp teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17579     for (int i = 0; i < 10; ++i)
17580       ++a;
17581   }
17582 #pragma omp target teams distribute simd
17583   for (int i = 0; i < 10; ++i) {
17584 #pragma omp teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17585     for (int i = 0; i < 10; ++i)
17586       ++a;
17587   }
17588 #pragma omp target teams distribute simd
17589   for (int i = 0; i < 10; ++i) {
17590 #pragma omp teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17591     for (int i = 0; i < 10; ++i)
17592       ++a;
17593   }
17594 #pragma omp target teams distribute simd
17595   for (int i = 0; i < 10; ++i) {
17596 #pragma omp teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17597     for (int i = 0; i < 10; ++i)
17598       ;
17599   }
17600 #pragma omp target teams distribute simd
17601   for (int i = 0; i < 10; ++i) {
17602 #pragma omp target teams // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17603     a++;
17604   }
17605 #pragma omp target teams distribute simd
17606   for (int i = 0; i < 10; ++i) {
17607 #pragma omp target teams distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17608     for (int i = 0; i < 10; ++i)
17609       ;
17610   }
17611 #pragma omp target teams distribute simd
17612   for (int i = 0; i < 10; ++i) {
17613 #pragma omp target teams distribute parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17614     for (int i = 0; i < 10; ++i)
17615       ;
17616   }
17617 #pragma omp target teams distribute simd
17618   for (int i = 0; i < 10; ++i) {
17619 #pragma omp target teams distribute parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17620     for (int i = 0; i < 10; ++i)
17621       ;
17622   }
17623 #pragma omp target teams distribute simd
17624   for (int i = 0; i < 10; ++i) {
17625 #pragma omp target teams distribute simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
17626     for (int i = 0; i < 10; ++i)
17627       ;
17628   }
17629 
17630   return foo<int>();
17631 }
17632 
17633