12e499eeeSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp-version=50 -fopenmp -ferror-limit 100 -o - -std=c++11 %s
22e499eeeSAlexey Bataev 
32e499eeeSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp-version=50 -fopenmp-simd -ferror-limit 100 -o - -std=c++11 %s
42e499eeeSAlexey Bataev 
foo()52e499eeeSAlexey Bataev void foo() {
62e499eeeSAlexey Bataev }
72e499eeeSAlexey Bataev 
foobool(int argc)82e499eeeSAlexey Bataev bool foobool(int argc) {
92e499eeeSAlexey Bataev   return argc;
102e499eeeSAlexey Bataev }
112e499eeeSAlexey Bataev 
122e499eeeSAlexey Bataev struct S1; // expected-note {{declared here}}
132e499eeeSAlexey Bataev 
142e499eeeSAlexey Bataev class vector {
152e499eeeSAlexey Bataev   public:
operator [](int index)162e499eeeSAlexey Bataev     int operator[](int index) { return 0; }
172e499eeeSAlexey Bataev };
182e499eeeSAlexey Bataev 
main(int argc,char ** argv,char * env[])192e499eeeSAlexey Bataev int main(int argc, char **argv, char *env[]) {
202e499eeeSAlexey Bataev   vector vec;
212e499eeeSAlexey Bataev   typedef float V __attribute__((vector_size(16)));
222e499eeeSAlexey Bataev   V a;
232e499eeeSAlexey Bataev   auto arr = x; // expected-error {{use of undeclared identifier 'x'}}
242e499eeeSAlexey Bataev 
252e499eeeSAlexey Bataev   #pragma omp task affinity(arr[0])
262e499eeeSAlexey Bataev   #pragma omp task affinity // expected-error {{expected '(' after 'affinity'}}
272e499eeeSAlexey Bataev   #pragma omp task affinity ( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
282e499eeeSAlexey Bataev   #pragma omp task affinity () // expected-error {{expected expression}}
292e499eeeSAlexey Bataev   #pragma omp task affinity (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
302e499eeeSAlexey Bataev   #pragma omp task affinity (argc)) // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
312e499eeeSAlexey Bataev   #pragma omp task affinity (foobool(argc)), affinity (in, argc) // expected-error {{expected addressable lvalue expression, array element, array section or array shaping expression}} expected-error {{use of undeclared identifier 'in'}}
322e499eeeSAlexey Bataev   #pragma omp task affinity (S1) // expected-error {{'S1' does not refer to a value}}
332e499eeeSAlexey Bataev   #pragma omp task affinity(argv[1][1] = '2')
342e499eeeSAlexey Bataev   #pragma omp task affinity (vec[1]) // expected-error {{expected addressable lvalue expression, array element, array section or array shaping expression}}
352e499eeeSAlexey Bataev   #pragma omp task affinity (in: argv[0]) // expected-error {{use of undeclared identifier 'in'}}
362e499eeeSAlexey Bataev   #pragma omp task affinity (main)
372e499eeeSAlexey Bataev   #pragma omp task affinity(a[0]) // expected-error {{expected addressable lvalue expression, array element, array section or array shaping expression}}
382e499eeeSAlexey Bataev   #pragma omp task affinity (vec[1:2]) // expected-error {{ value is not an array or pointer}}
392e499eeeSAlexey Bataev   #pragma omp task affinity (argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
402e499eeeSAlexey Bataev   #pragma omp task affinity (argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
412e499eeeSAlexey Bataev   #pragma omp task affinity (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 '('}}
422e499eeeSAlexey Bataev   #pragma omp task affinity (argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
432e499eeeSAlexey Bataev   #pragma omp task affinity (argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '('}}
442e499eeeSAlexey Bataev   #pragma omp task affinity (argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}}
452e499eeeSAlexey Bataev   #pragma omp task affinity (argv[-1:0])
462e499eeeSAlexey Bataev   #pragma omp task affinity (argv[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
472e499eeeSAlexey Bataev   #pragma omp task affinity (argv[3:4:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
482e499eeeSAlexey Bataev   #pragma omp task affinity(a[0:1]) // expected-error {{subscripted value is not an array or pointer}}
492e499eeeSAlexey Bataev   #pragma omp task affinity(argv[argv[:2]:1]) // expected-error {{OpenMP array section is not allowed here}}
502e499eeeSAlexey Bataev   #pragma omp task affinity(argv[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
512e499eeeSAlexey Bataev   #pragma omp task affinity(env[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}}
522e499eeeSAlexey Bataev   #pragma omp task affinity(argv[ : argc][1 : argc - 1])
532e499eeeSAlexey Bataev   #pragma omp task affinity(arr[0])
542e499eeeSAlexey Bataev   #pragma omp task affinity(([ // expected-error {{expected variable name or 'this' in lambda capture list}} expected-error {{expected ')'}} expected-note {{to match this '('}}
552e499eeeSAlexey Bataev   #pragma omp task affinity(([] // expected-error {{expected body of lambda expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
562e499eeeSAlexey Bataev   #pragma omp task affinity(([]) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error 2 {{expected expression}}
572e499eeeSAlexey Bataev   #pragma omp task affinity(([])a // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
582e499eeeSAlexey Bataev   #pragma omp task affinity(([])a) // expected-error {{expected expression}}
592e499eeeSAlexey Bataev   #pragma omp task affinity(([a])a) // expected-error {{expected expression with a pointer to a complete type as a base of an array shaping operation}}
602e499eeeSAlexey Bataev   #pragma omp task affinity(([a])argc) // expected-error {{expected expression with a pointer to a complete type as a base of an array shaping operation}}
612e499eeeSAlexey Bataev   #pragma omp task affinity(([-1][0])argv) // expected-error {{array shaping dimension is evaluated to a non-positive value -1}} expected-error {{array shaping dimension is evaluated to a non-positive value 0}}
622e499eeeSAlexey Bataev   #pragma omp task affinity(iterator // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected '(' after 'iterator'}} expected-error {{expected expression}}
632e499eeeSAlexey Bataev   #pragma omp task affinity(iterator():argc)
642e499eeeSAlexey Bataev   #pragma omp task affinity(iterator(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{unknown type name 'argc'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
652e499eeeSAlexey Bataev   #pragma omp task affinity(iterator(unsigned argc: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected '=' in iterator specifier}} expected-error 2 {{expected expression}} expected-error {{expected ',' or ')' after iterator specifier}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
662e499eeeSAlexey Bataev   #pragma omp task affinity(iterator(unsigned argc = // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error 2 {{expected expression}} expected-error {{expected ',' or ')' after iterator specifier}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
672e499eeeSAlexey Bataev   #pragma omp task affinity(iterator(vector argc = 0:2):argc) // expected-error {{expected integral or pointer type as the iterator-type, not 'vector'}} expected-error {{expected expression}}
68*131e8786SDavid Blaikie   #pragma omp task affinity(iterator(vector *argc = nullptr:nullptr+2:0):argc) // expected-error {{invalid operands to binary expression ('std::nullptr_t' and 'int')}} expected-error {{iterator step expression 0 evaluates to 0}} expected-error {{expected expression}}
692e499eeeSAlexey Bataev   #pragma omp task affinity(iterator(vector *argc = 0:vector():argc):argc) // expected-error {{converting 'vector' to incompatible type 'vector *'}} expected-error {{expected expression}}
702e499eeeSAlexey Bataev   foo();
712e499eeeSAlexey Bataev #pragma omp task affinity(iterator(i = 0:10, i = 0:10) : argv[i]) // expected-error {{redefinition of 'i'}} expected-note {{previous definition is here}}
722e499eeeSAlexey Bataev   i = 0; // expected-error {{use of undeclared identifier 'i'}}
732e499eeeSAlexey Bataev 
742e499eeeSAlexey Bataev   return 0;
752e499eeeSAlexey Bataev }
76