1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %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 class vector {
13   public:
14     int operator[](int index) { return 0; }
15 };
16 
17 int main(int argc, char **argv, char *env[]) {
18   vector vec;
19   typedef float V __attribute__((vector_size(16)));
20   V a;
21   auto arr = x; // expected-error {{use of undeclared identifier 'x'}}
22 
23   #pragma omp task depend // expected-error {{expected '(' after 'depend'}}
24   #pragma omp task depend ( // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}}
25   #pragma omp task depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}}
26   #pragma omp task depend (argc // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27   #pragma omp task depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}}
28   #pragma omp task depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}}
29   #pragma omp task depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
30   #pragma omp task depend (out: ) // expected-error {{expected expression}}
31   #pragma omp task depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected variable name, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
32   #pragma omp task depend (out :S1) // expected-error {{'S1' does not refer to a value}}
33   #pragma omp task depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}}
34   #pragma omp task depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}}
35   #pragma omp task depend (in : argv[0])
36   #pragma omp task depend (in : ) // expected-error {{expected expression}}
37   #pragma omp task depend (in : main) // expected-error {{expected variable name, array element or array section}}
38   #pragma omp task depend(in : a[0]) // expected-error{{expected variable name, array element or array section}}
39   #pragma omp task depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}}
40   #pragma omp task depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
41   #pragma omp task depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
42   #pragma omp task depend (in : argv[:] // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} expected-error {{expected ')'}} expected-note {{to match this '('}}
43   #pragma omp task depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
44   #pragma omp task depend (in : argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '('}}
45   #pragma omp task depend (in : argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}}
46   #pragma omp task depend (in : argv[-1:0]) // expected-error {{section lower bound is evaluated to a negative value -1}}
47   #pragma omp task depend (in : argv[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
48   #pragma omp task depend (in : argv[3:4:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
49   #pragma omp task depend(in:a[0:1]) // expected-error {{subscripted value is not an array or pointer}}
50   #pragma omp task depend(in:argv[argv[:2]:1]) // expected-error {{OpenMP array section is not allowed here}}
51   #pragma omp task depend(in:argv[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
52   #pragma omp task depend(in:env[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}}
53   #pragma omp task depend(in : argv[ : argc][1 : argc - 1])
54   #pragma omp task depend(in : arr[0])
55   foo();
56 
57   return 0;
58 }
59