1b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
2176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
3176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid foo() {
4176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
5176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
6176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesbool foobool(int argc) {
7176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return argc;
8176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
9176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
10176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesstruct S1; // expected-note {{declared here}}
11176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
12176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinestemplate <class T, class S> // expected-note {{declared here}}
13176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesint tmain(T argc, S **argv) {
14176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final // expected-error {{expected '(' after 'final'}}
15176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
16176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final () // expected-error {{expected expression}}
17176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
18176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argc)) // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
19176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argc > 0 ? argv[1] : argv[2])
20176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (foobool(argc)), final (true) // expected-error {{directive '#pragma omp task' cannot contain more than one 'final' clause}}
21176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (S) // expected-error {{'S' does not refer to a value}}
22176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
23176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
24176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final(argc)
25176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  foo();
26176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
27176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return 0;
28176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
29176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
30176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesint main(int argc, char **argv) {
31176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final // expected-error {{expected '(' after 'final'}}
32176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
33176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final () // expected-error {{expected expression}}
34176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
35176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argc)) // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
36176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argc > 0 ? argv[1] : argv[2])
37176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (foobool(argc)), final (true) // expected-error {{directive '#pragma omp task' cannot contain more than one 'final' clause}}
38176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (S1) // expected-error {{'S1' does not refer to a value}}
39176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
40176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
41176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
42176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  #pragma omp task final(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
43176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  foo();
44176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
45176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return tmain(argc, argv);
46176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
47