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}} expected-note {{declared here}} 11 12 class vector { 13 public: 14 int operator[](int index) { return 0; } 15 }; 16 17 template <class T, class S, class R> 18 int tmain(T argc, S **argv, R *env[]) { 19 vector vec; 20 typedef float V __attribute__((vector_size(16))); 21 V a; 22 char *arr; 23 24 int i; 25 #pragma omp target exit data map(from: i) depend // expected-error {{expected '(' after 'depend'}} 26 foo(); 27 #pragma omp target exit data map(from: i) 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}} 28 foo(); 29 #pragma omp target exit data map(from: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} 30 foo(); 31 #pragma omp target exit data map(from: i) 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 '('}} 32 foo(); 33 #pragma omp target exit data map(from: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} 34 foo(); 35 #pragma omp target exit data map(from: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} 36 foo(); 37 #pragma omp target exit data map(from: i) depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target exit data' are ignored}} 38 foo(); 39 #pragma omp target exit data map(from: i) depend (out: ) // expected-error {{expected expression}} 40 foo(); 41 #pragma omp target exit data map(from: i) 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}} 42 foo(); 43 #pragma omp target exit data map(from: i) depend (out :S1) // expected-error {{'S1' does not refer to a value}} 44 foo(); 45 #pragma omp target exit data map(from: i) depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}} 46 foo(); 47 #pragma omp target exit data map(from: i) depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}} 48 foo(); 49 #pragma omp target exit data map(from: i) depend (in : argv[0]) 50 foo(); 51 #pragma omp target exit data map(from: i) depend (in : ) // expected-error {{expected expression}} 52 foo(); 53 #pragma omp target exit data map(from: i) depend (in : tmain) // expected-error {{expected variable name, array element or array section}} 54 foo(); 55 #pragma omp target exit data map(from: i) depend(in : a[0]) // expected-error{{expected variable name, array element or array section}} 56 foo(); 57 #pragma omp target exit data map(from: i) depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}} 58 foo(); 59 #pragma omp target exit data map(from: i) depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} 60 foo(); 61 #pragma omp target exit data map(from: i) depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} 62 foo(); 63 #pragma omp target exit data map(from: i) 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 '('}} 64 foo(); 65 #pragma omp target exit data map(from: i) depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} 66 foo(); 67 #pragma omp target exit data map(from: i) depend (in : argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '('}} 68 foo(); 69 #pragma omp target exit data map(from: i) depend (in : argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}} 70 foo(); 71 #pragma omp target exit data map(from: i) depend (in : argv[-1:0]) // expected-error {{section lower bound is evaluated to a negative value -1}} 72 foo(); 73 #pragma omp target exit data map(from: i) depend (in : argv[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} 74 foo(); 75 #pragma omp target exit data map(from: i) depend (in : argv[3:4:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}} 76 foo(); 77 #pragma omp target exit data map(from: i) depend(in:a[0:1]) // expected-error {{subscripted value is not an array or pointer}} 78 foo(); 79 #pragma omp target exit data map(from: i) depend(in:argv[argv[:2]:1]) // expected-error {{OpenMP array section is not allowed here}} 80 foo(); 81 #pragma omp target exit data map(from: i) depend(in:argv[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} 82 foo(); 83 #pragma omp target exit data map(from: i) depend(in:env[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}} 84 foo(); 85 #pragma omp target exit data map(from: i) depend(in : argv[ : argc][1 : argc - 1]) 86 foo(); 87 #pragma omp target exit data map(from: i) depend(in : arr[0]) 88 foo(); 89 90 return 0; 91 } 92 93 int main(int argc, char **argv, char *env[]) { 94 vector vec; 95 typedef float V __attribute__((vector_size(16))); 96 V a; 97 char *arr; 98 99 int i; 100 #pragma omp target exit data map(from: i) depend // expected-error {{expected '(' after 'depend'}} 101 foo(); 102 #pragma omp target exit data map(from: i) 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}} 103 foo(); 104 #pragma omp target exit data map(from: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} 105 foo(); 106 #pragma omp target exit data map(from: i) 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 '('}} 107 foo(); 108 #pragma omp target exit data map(from: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} 109 foo(); 110 #pragma omp target exit data map(from: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} 111 foo(); 112 #pragma omp target exit data map(from: i) depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target exit data' are ignored}} 113 foo(); 114 #pragma omp target exit data map(from: i) depend (out: ) // expected-error {{expected expression}} 115 foo(); 116 #pragma omp target exit data map(from: i) 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}} 117 foo(); 118 #pragma omp target exit data map(from: i) depend (out :S1) // expected-error {{'S1' does not refer to a value}} 119 foo(); 120 #pragma omp target exit data map(from: i) depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}} 121 foo(); 122 #pragma omp target exit data map(from: i) depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}} 123 foo(); 124 #pragma omp target exit data map(from: i) depend (in : argv[0]) 125 foo(); 126 #pragma omp target exit data map(from: i) depend (in : ) // expected-error {{expected expression}} 127 foo(); 128 #pragma omp target exit data map(from: i) depend (in : main) // expected-error {{expected variable name, array element or array section}} 129 foo(); 130 #pragma omp target exit data map(from: i) depend(in : a[0]) // expected-error{{expected variable name, array element or array section}} 131 foo(); 132 #pragma omp target exit data map(from: i) depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}} 133 foo(); 134 #pragma omp target exit data map(from: i) depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} 135 foo(); 136 #pragma omp target exit data map(from: i) depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} 137 foo(); 138 #pragma omp target exit data map(from: i) 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 '('}} 139 foo(); 140 #pragma omp target exit data map(from: i) depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} 141 foo(); 142 #pragma omp target exit data map(from: i) depend (in : argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '('}} 143 foo(); 144 #pragma omp target exit data map(from: i) depend (in : argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}} 145 foo(); 146 #pragma omp target exit data map(from: i) depend (in : argv[-1:0]) // expected-error {{section lower bound is evaluated to a negative value -1}} 147 foo(); 148 #pragma omp target exit data map(from: i) depend (in : argv[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} 149 foo(); 150 #pragma omp target exit data map(from: i) depend (in : argv[3:4:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}} 151 foo(); 152 #pragma omp target exit data map(from: i) depend(in:a[0:1]) // expected-error {{subscripted value is not an array or pointer}} 153 foo(); 154 #pragma omp target exit data map(from: i) depend(in:argv[argv[:2]:1]) // expected-error {{OpenMP array section is not allowed here}} 155 foo(); 156 #pragma omp target exit data map(from: i) depend(in:argv[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} 157 foo(); 158 #pragma omp target exit data map(from: i) depend(in:env[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}} 159 foo(); 160 #pragma omp target exit data map(from: i) depend(in : argv[ : argc][1 : argc - 1]) 161 foo(); 162 #pragma omp target exit data map(from: i) depend(in : arr[0]) 163 foo(); 164 165 return tmain(argc, argv, env); // expected-note {{in instantiation of function template specialization 'tmain<int, char, char>' requested here}} 166 } 167