1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
2 
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
4 
5 template <class T>
tmain(T argc)6 T tmain(T argc) {
7 #pragma omp taskyield
8   ;
9 #pragma omp taskyield untied  // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp taskyield'}}
10 #pragma omp taskyield unknown // expected-warning {{extra tokens at the end of '#pragma omp taskyield' are ignored}}
11   if (argc)
12 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
13     if (argc) {
14 #pragma omp taskyield
15     }
16   while (argc)
17 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
18     while (argc) {
19 #pragma omp taskyield
20     }
21   do
22 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
23     while (argc)
24       ;
25   do {
26 #pragma omp taskyield
27   } while (argc);
28   switch (argc)
29 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
30     switch (argc)
31     case 1:
32 #pragma omp taskyield
33   switch (argc)
34   case 1: {
35 #pragma omp taskyield
36   }
37   switch (argc) {
38 #pragma omp taskyield
39   case 1:
40 #pragma omp taskyield
41     break;
42   default: {
43 #pragma omp taskyield
44   } break;
45   }
46   for (;;)
47 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
48     for (;;) {
49 #pragma omp taskyield
50     }
51 label:
52 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
53 label1 : {
54 #pragma omp taskyield
55 }
56 
57   return T();
58 }
59 
main(int argc,char ** argv)60 int main(int argc, char **argv) {
61 #pragma omp taskyield
62   ;
63 #pragma omp taskyield untied  // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp taskyield'}}
64 #pragma omp taskyield unknown // expected-warning {{extra tokens at the end of '#pragma omp taskyield' are ignored}}
65   if (argc)
66 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
67     if (argc) {
68 #pragma omp taskyield
69     }
70   while (argc)
71 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
72     while (argc) {
73 #pragma omp taskyield
74     }
75   do
76 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
77     while (argc)
78       ;
79   do {
80 #pragma omp taskyield
81   } while (argc);
82   switch (argc)
83 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
84     switch (argc)
85     case 1:
86 #pragma omp taskyield
87   switch (argc)
88   case 1: {
89 #pragma omp taskyield
90   }
91   switch (argc) {
92 #pragma omp taskyield
93   case 1:
94 #pragma omp taskyield
95     break;
96   default: {
97 #pragma omp taskyield
98   } break;
99   }
100   for (;;)
101 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
102     for (;;) {
103 #pragma omp taskyield
104     }
105 label:
106 #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
107 label1 : {
108 #pragma omp taskyield
109 }
110 
111   return tmain(argc);
112 }
113