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