1 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -x c++ -std=c++11 -fms-extensions -Wno-pragma-pack %s
3 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp-simd -x c++ -std=c++11 -fms-extensions -Wno-pragma-pack %s
5 // expected-error@+1 {{expected an OpenMP directive}}
8 // expected-error@+2 {{'#pragma omp declare simd' can only be applied to functions}}
9 #pragma omp declare simd
11 // expected-error@+2 {{'#pragma omp declare simd' can only be applied to functions}}
12 #pragma omp declare simd
13 #pragma omp threadprivate(a)
15 #pragma omp threadprivate(var)
17 // expected-error@+2 {{expected an OpenMP directive}} expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
18 #pragma omp declare simd
21 // expected-error@+3 {{function declaration is expected after 'declare simd' directive}}
22 // expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
23 #pragma omp declare simd
24 #pragma omp declare simd
25 #pragma options align=packed
28 // expected-error@+3 {{function declaration is expected after 'declare simd' directive}}
29 // expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
30 #pragma omp declare simd
31 #pragma omp declare simd
32 #pragma init_seg(compiler)
36 // expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
37 #pragma omp declare simd
39 T
infunc1(T a
), infunc2(T a
);
42 // expected-error@+1 {{single declaration is expected after 'declare simd' directive}}
43 #pragma omp declare simd
44 // expected-note@+1 {{declared here}}
47 // expected-error@+1 {{'C' does not refer to a value}}
48 #pragma omp declare simd simdlen(C)
49 // expected-note@+1 {{declared here}}
51 void h(C
*hp
, C
*hp2
, C
*hq
, C
*lin
) {
55 #pragma omp declare simd
57 void h(int *hp
, int *hp2
, int *hq
, int *lin
) {
58 h((float *)hp
, (float *)hp2
, (float *)hq
, (float *)lin
);
61 #pragma omp declare simd inbranch inbranch
62 #pragma omp declare simd notinbranch notinbranch
63 #pragma omp declare simd inbranch inbranch notinbranch // expected-error {{unexpected 'notinbranch' clause, 'inbranch' is specified already}}
64 #pragma omp declare simd notinbranch notinbranch inbranch // expected-error {{unexpected 'inbranch' clause, 'notinbranch' is specified already}}
65 // expected-note@+2 {{read of non-const variable 'b' is not allowed in a constant expression}}
66 // expected-error@+1 {{integral constant expression}}
67 #pragma omp declare simd simdlen(b)
68 // expected-error@+1 {{directive '#pragma omp declare simd' cannot contain more than one 'simdlen' clause}}
69 #pragma omp declare simd simdlen(32) simdlen(c)
70 // expected-error@+1 {{expected '(' after 'simdlen'}}
71 #pragma omp declare simd simdlen
72 // expected-note@+3 {{to match this '('}}
73 // expected-error@+2 {{expected ')'}}
74 // expected-error@+1 {{expected expression}}
75 #pragma omp declare simd simdlen(
76 // expected-error@+2 {{expected '(' after 'simdlen'}}
77 // expected-error@+1 {{expected expression}}
78 #pragma omp declare simd simdlen(), simdlen
79 // expected-error@+1 2 {{expected expression}}
80 #pragma omp declare simd simdlen(), simdlen()
81 // expected-warning@+3 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}
82 // expected-error@+2 {{expected '(' after 'simdlen'}}
83 // expected-error@+1 {{expected expression}}
84 #pragma omp declare simd simdlen() simdlen)
87 // expected-error@+3 4 {{expected reference to one of the parameters of function 'foo'}}
88 // expected-error@+2 {{invalid use of 'this' outside of a non-static member function}}
89 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
90 #pragma omp declare simd simdlen(N) uniform(this, var) aligned(var)
95 // expected-note@+1 {{in instantiation of function template specialization 'foo<-3>' requested here}}
99 // expected-error@+1 {{expected '(' after 'uniform'}}
100 #pragma omp declare simd uniform
101 // expected-note@+3 {{to match this '('}}
102 // expected-error@+2 {{expected ')'}}
103 // expected-error@+1 {{expected expression}}
104 #pragma omp declare simd uniform(
105 // expected-error@+1 {{expected expression}}
106 #pragma omp declare simd uniform()
107 // expected-note@+3 {{to match this '('}}
108 // expected-error@+2 {{expected ')'}}
109 // expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}
110 #pragma omp declare simd uniform(this
111 // expected-note@+3 {{to match this '('}}
112 // expected-error@+2 {{expected ')'}}
113 // expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}
114 #pragma omp declare simd uniform(this,a
115 // expected-error@+1 {{expected expression}}
116 #pragma omp declare simd uniform(,a)
117 // expected-error@+1 {{expected '(' after 'aligned'}}
118 #pragma omp declare simd aligned
119 // expected-note@+3 {{to match this '('}}
120 // expected-error@+2 {{expected ')'}}
121 // expected-error@+1 {{expected expression}}
122 #pragma omp declare simd aligned(
123 // expected-error@+1 {{expected expression}}
124 #pragma omp declare simd aligned()
125 // expected-error@+4 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
126 // expected-note@+3 {{to match this '('}}
127 // expected-error@+2 {{expected ')'}}
128 // expected-error@+1 {{expected expression}}
129 #pragma omp declare simd aligned(a:
130 // expected-error@+1 {{expected expression}} expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
131 #pragma omp declare simd aligned(a:)
132 // expected-warning@+2 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}
133 // expected-error@+1 {{expected '(' after 'aligned'}}
134 #pragma omp declare simd aligned :)
135 // expected-note@+3 {{to match this '('}}
136 // expected-error@+2 {{expected ')'}}
137 // expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}
138 #pragma omp declare simd aligned(this
139 // expected-note@+3 {{to match this '('}}
140 // expected-error@+2 {{expected ')'}}
141 // expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}
142 #pragma omp declare simd aligned(this,b
143 // expected-error@+1 {{expected expression}}
144 #pragma omp declare simd aligned(, b)
145 // expected-note@+4 {{defined as aligned}}
146 // expected-error@+3 {{a parameter cannot appear in more than one aligned clause}}
147 // expected-error@+2 {{expected expression}}
148 // expected-error@+1 {{expected ',' or ')' in 'aligned' clause}}
149 #pragma omp declare simd aligned(b) aligned(b ; 64)
150 // expected-note@+2 {{defined as aligned}}
151 // expected-error@+1 {{a parameter cannot appear in more than one aligned clause}}
152 #pragma omp declare simd aligned(b) aligned(b: 64)
153 // expected-error@+1 {{argument to 'aligned' clause must be a strictly positive integer value}}
154 #pragma omp declare simd aligned(b: -1)
155 // expected-warning@+1 {{aligned clause will be ignored because the requested alignment is not a power of 2}}
156 #pragma omp declare simd aligned(b: 3)
157 // expected-error@+1 {{expected '(' after 'linear'}}
158 #pragma omp declare simd linear
159 // expected-note@+3 {{to match this '('}}
160 // expected-error@+2 {{expected ')'}}
161 // expected-error@+1 {{expected expression}}
162 #pragma omp declare simd linear(
163 // expected-error@+1 {{expected expression}}
164 #pragma omp declare simd linear()
165 // expected-note@+3 {{to match this '('}}
166 // expected-error@+2 {{expected ')'}}
167 // expected-error@+1 {{expected expression}}
168 #pragma omp declare simd linear(a:
169 // expected-error@+1 {{expected expression}}
170 #pragma omp declare simd linear(a:)
171 // expected-warning@+2 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}
172 // expected-error@+1 {{expected '(' after 'linear'}}
173 #pragma omp declare simd linear :)
174 // expected-note@+3 {{to match this '('}}
175 // expected-error@+2 {{expected ')'}}
176 // expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}
177 #pragma omp declare simd linear(this
178 // expected-note@+3 {{to match this '('}}
179 // expected-error@+2 {{expected ')'}}
180 // expected-error@+1 {{invalid use of 'this' outside of a non-static member function}}
181 #pragma omp declare simd linear(this,b
182 // expected-error@+1 {{expected expression}}
183 #pragma omp declare simd linear(, b)
184 // expected-note@+4 {{defined as linear}}
185 // expected-error@+3 {{linear variable cannot be linear}}
186 // expected-error@+2 {{expected expression}}
187 // expected-error@+1 {{expected ',' or ')' in 'linear' clause}}
188 #pragma omp declare simd linear(b) linear(b ; 64)
189 // expected-note@+2 {{defined as linear}}
190 // expected-error@+1 {{linear variable cannot be linear}}
191 #pragma omp declare simd linear(b) linear(b: 64)
192 #pragma omp declare simd linear(b: -1)
193 #pragma omp declare simd linear(b: 3)
194 // expected-error@+1 {{expected a reference to a parameter specified in a 'uniform' clause}}
195 #pragma omp declare simd linear(b: a)
196 // expected-note@+2 {{defined as uniform}}
197 // expected-error@+1 {{linear variable cannot be uniform}}
198 #pragma omp declare simd uniform(a), linear(a: 4)
199 // expected-note@+2 {{defined as uniform}}
200 // expected-error@+1 {{linear variable cannot be uniform}}
201 #pragma omp declare simd linear(a: 4) uniform(a)
202 // expected-error@+1 {{variable of non-reference type 'int *' can be used only with 'val' modifier, but used with 'uval'}}
203 #pragma omp declare simd linear(uval(b))
204 // expected-error@+1 {{variable of non-reference type 'int *' can be used only with 'val' modifier, but used with 'ref'}}
205 #pragma omp declare simd linear(ref(b))
206 // expected-error@+1 {{expected one of 'ref', val' or 'uval' modifiers}} expected-warning@+1 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}
207 #pragma omp declare simd linear(uref(b)) allocate(b)
208 #pragma omp declare simd linear(ref(c))
209 // expected-note@+2 {{'a' declared here}}
210 // expected-note@+1 {{'a' declared here}}
211 void bar(int a
, int *b
, float &c
);
215 // expected-error@+2 {{function declaration is expected after 'declare simd' directive}}
216 #pragma init_seg(compiler)
217 #pragma omp declare simd
218 #pragma init_seg(compiler)
219 // expected-note@+7 {{defined as uniform}}
220 // expected-error@+6 {{expected a reference to a parameter specified in a 'uniform' clause}}
221 // expected-error@+5 {{linear variable cannot be uniform}}
222 // expected-note@+4 {{defined as aligned}}
223 // expected-error@+3 {{argument to 'aligned' clause must be a strictly positive integer value}}
224 // expected-error@+2 {{'this' cannot appear in more than one aligned clause}}
225 // expected-error@+1 {{use of undeclared identifier 't'}}
226 #pragma omp declare simd uniform(this, t) aligned(this: 4) aligned(this: -4) linear(this: hp)
228 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp declare simd'}}
229 #pragma omp declare simd
238 // expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
239 #pragma omp declare simd
241 // expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
242 #pragma omp declare simd
243 // expected-error@+1 {{function declaration is expected after 'declare simd' directive}}
244 #pragma omp declare simd