1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
2 
3 void foo() {
4 }
5 
6 bool foobool(int argc) {
7   return argc;
8 }
9 
10 struct S1; // expected-note {{declared here}}
11 
12 template <class T, class S> // expected-note {{declared here}}
13 int tmain(T argc, S **argv) {
14   #pragma omp task final // expected-error {{expected '(' after 'final'}}
15   #pragma omp task final ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
16   #pragma omp task final () // expected-error {{expected expression}}
17   #pragma omp task final (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
18   #pragma omp task final (argc)) // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
19   #pragma omp task final (argc > 0 ? argv[1] : argv[2])
20   #pragma omp task final (foobool(argc)), final (true) // expected-error {{directive '#pragma omp task' cannot contain more than one 'final' clause}}
21   #pragma omp task final (S) // expected-error {{'S' does not refer to a value}}
22   #pragma omp task final (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
23   #pragma omp task final (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
24   #pragma omp task final(argc)
25   foo();
26 
27   return 0;
28 }
29 
30 int main(int argc, char **argv) {
31   #pragma omp task final // expected-error {{expected '(' after 'final'}}
32   #pragma omp task final ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
33   #pragma omp task final () // expected-error {{expected expression}}
34   #pragma omp task final (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
35   #pragma omp task final (argc)) // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
36   #pragma omp task final (argc > 0 ? argv[1] : argv[2])
37   #pragma omp task final (foobool(argc)), final (true) // expected-error {{directive '#pragma omp task' cannot contain more than one 'final' clause}}
38   #pragma omp task final (S1) // expected-error {{'S1' does not refer to a value}}
39   #pragma omp task final (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
40   #pragma omp task final (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
41   #pragma omp task final (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
42   #pragma omp task final(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
43   foo();
44 
45   return tmain(argc, argv);
46 }
47