1 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s
2
foo()3 void foo() {
4 }
5
foobool(int argc)6 bool foobool(int argc) {
7 return argc;
8 }
9
10 struct S1; // expected-note {{declared here}}
11
12 class vector {
13 public:
operator [](int index)14 int operator[](int index) { return 0; }
15 };
16
main(int argc,char ** argv,char * env[])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 int i;
23
24 #pragma omp target parallel for simd depend // expected-error {{expected '(' after 'depend'}}
25 for (i = 0; i < argc; ++i) foo();
26 #pragma omp target parallel for simd 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}}
27 for (i = 0; i < argc; ++i) foo();
28 #pragma omp target parallel for simd depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}}
29 for (i = 0; i < argc; ++i) foo();
30 #pragma omp target parallel for simd 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 '('}}
31 for (i = 0; i < argc; ++i) foo();
32 #pragma omp target parallel for simd depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}}
33 for (i = 0; i < argc; ++i) foo();
34 #pragma omp target parallel for simd depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}}
35 for (i = 0; i < argc; ++i) foo();
36 #pragma omp target parallel for simd depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel for simd' are ignored}}
37 for (i = 0; i < argc; ++i) foo();
38 #pragma omp target parallel for simd depend (out: ) // expected-error {{expected expression}}
39 for (i = 0; i < argc; ++i) foo();
40 #pragma omp target parallel for simd 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}}
41 for (i = 0; i < argc; ++i) foo();
42 #pragma omp target parallel for simd depend (out :S1) // expected-error {{'S1' does not refer to a value}}
43 for (i = 0; i < argc; ++i) foo();
44 #pragma omp target parallel for simd depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}}
45 for (i = 0; i < argc; ++i) foo();
46 #pragma omp target parallel for simd depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}}
47 for (i = 0; i < argc; ++i) foo();
48 #pragma omp target parallel for simd depend (in : argv[0])
49 for (i = 0; i < argc; ++i) foo();
50 #pragma omp target parallel for simd depend (in : ) // expected-error {{expected expression}}
51 for (i = 0; i < argc; ++i) foo();
52 #pragma omp target parallel for simd depend (in : main) // expected-error {{expected variable name, array element or array section}}
53 for (i = 0; i < argc; ++i) foo();
54 #pragma omp target parallel for simd depend(in : a[0]) // expected-error{{expected variable name, array element or array section}}
55 for (i = 0; i < argc; ++i) foo();
56 #pragma omp target parallel for simd depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}}
57 for (i = 0; i < argc; ++i) foo();
58 #pragma omp target parallel for simd depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
59 for (i = 0; i < argc; ++i) foo();
60 #pragma omp target parallel for simd depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
61 for (i = 0; i < argc; ++i) foo();
62 #pragma omp target parallel for simd 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 '('}}
63 for (i = 0; i < argc; ++i) foo();
64 #pragma omp target parallel for simd depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
65 for (i = 0; i < argc; ++i) foo();
66 #pragma omp target parallel for simd depend (in : argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '('}}
67 for (i = 0; i < argc; ++i) foo();
68 #pragma omp target parallel for simd depend (in : argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}}
69 for (i = 0; i < argc; ++i) foo();
70 #pragma omp target parallel for simd depend (in : argv[-1:0]) // expected-error {{section lower bound is evaluated to a negative value -1}}
71 for (i = 0; i < argc; ++i) foo();
72 #pragma omp target parallel for simd depend (in : argv[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
73 for (i = 0; i < argc; ++i) foo();
74 #pragma omp target parallel for simd depend (in : argv[3:4:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
75 for (i = 0; i < argc; ++i) foo();
76 #pragma omp target parallel for simd depend(in:a[0:1]) // expected-error {{subscripted value is not an array or pointer}}
77 for (i = 0; i < argc; ++i) foo();
78 #pragma omp target parallel for simd depend(in:argv[argv[:2]:1]) // expected-error {{OpenMP array section is not allowed here}}
79 for (i = 0; i < argc; ++i) foo();
80 #pragma omp target parallel for simd depend(in:argv[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
81 for (i = 0; i < argc; ++i) foo();
82 #pragma omp target parallel for simd depend(in:env[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}}
83 for (i = 0; i < argc; ++i) foo();
84 #pragma omp target parallel for simd depend(in : argv[ : argc][1 : argc - 1])
85 for (i = 0; i < argc; ++i) foo();
86 #pragma omp target parallel for simd depend(in : arr[0])
87 for (i = 0; i < argc; ++i) foo();
88
89 return 0;
90 }
91