1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s
6 bool foobool(int argc) {
10 struct S1; // expected-note {{declared here}}
12 template <class T, class S> // expected-note {{declared here}}
13 int tmain(T argc, S **argv) {
14 #pragma omp target teams if // expected-error {{expected '(' after 'if'}}
16 #pragma omp target teams if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
18 #pragma omp target teams if () // expected-error {{expected expression}}
20 #pragma omp target teams if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
22 #pragma omp target teams if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}}
24 #pragma omp target teams if (argc > 0 ? argv[1] : argv[2])
26 #pragma omp target teams if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'if' clause}}
28 #pragma omp target teams if (S) // expected-error {{'S' does not refer to a value}}
30 #pragma omp target teams if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
32 #pragma omp target teams if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
34 #pragma omp target teams if(argc)
36 #pragma omp target teams if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
38 #pragma omp target teams if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
40 #pragma omp target teams if(target : argc)
42 #pragma omp target teams if(target : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target teams'}}
44 #pragma omp target teams if(target : argc) if (target:argc) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'if' clause with 'target' name modifier}}
46 #pragma omp target teams if(target : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
52 int main(int argc, char **argv) {
53 #pragma omp target teams if // expected-error {{expected '(' after 'if'}}
55 #pragma omp target teams if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
57 #pragma omp target teams if () // expected-error {{expected expression}}
59 #pragma omp target teams if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
61 #pragma omp target teams if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}}
63 #pragma omp target teams if (argc > 0 ? argv[1] : argv[2])
65 #pragma omp target teams if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'if' clause}}
67 #pragma omp target teams if (S1) // expected-error {{'S1' does not refer to a value}}
69 #pragma omp target teams if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
71 #pragma omp target teams if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
73 #pragma omp target teams if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
75 #pragma omp target teams if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
77 #pragma omp target teams if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
79 #pragma omp target teams if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
81 #pragma omp target teams if(target : argc)
83 #pragma omp target teams if(target : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target teams'}}
85 #pragma omp target teams if(target : argc) if (target:argc) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'if' clause with 'target' name modifier}}
87 #pragma omp target teams if(target : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
90 return tmain(argc, argv);