1 // RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp-simd %s -Wuninitialized
6 static int ib
[20]; // expected-note 0 {{'B::ib' declared here}}
7 static constexpr int bfoo() { return 8; }
10 B x
; // expected-note {{'x' defined here}}
12 constexpr int bfoo() { return 4; }
17 void test_aligned_colons(int *&rp
)
23 #pragma omp distribute parallel for simd aligned(B:bfoo())
24 for (int i
= 0; i
< 10; ++i
) ;
28 #pragma omp distribute parallel for simd aligned(B::ib:B:bfoo()) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'}}
29 for (int i
= 0; i
< 10; ++i
) ;
33 #pragma omp distribute parallel for simd aligned(B:B::bfoo())
34 for (int i
= 0; i
< 10; ++i
) ;
38 #pragma omp distribute parallel for simd aligned(z:B:bfoo()) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}}
39 for (int i
= 0; i
< 10; ++i
) ;
43 #pragma omp distribute parallel for simd aligned(B:B::bfoo())
44 for (int i
= 0; i
< 10; ++i
) ;
48 #pragma omp distribute parallel for simd aligned(X::x : ::z) // expected-error {{integral constant expression must have integral or unscoped enumeration type, not 'int **'}} expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'B'}}
49 for (int i
= 0; i
< 10; ++i
) ;
53 #pragma omp distribute parallel for simd aligned(B,rp,::z: X::x) // expected-error {{integral constant expression must have integral or unscoped enumeration type, not 'B'}}
54 for (int i
= 0; i
< 10; ++i
) ;
58 #pragma omp distribute parallel for simd aligned(::z)
59 for (int i
= 0; i
< 10; ++i
) ;
61 #pragma omp distribute parallel for simd aligned(B::bfoo()) // expected-error {{expected variable name}}
62 for (int i
= 0; i
< 10; ++i
) ;
66 #pragma omp distribute parallel for simd aligned(B::ib,B:C1+C2) // expected-warning {{aligned clause will be ignored because the requested alignment is not a power of 2}}
67 for (int i
= 0; i
< 10; ++i
) ;
70 // expected-note@+1 {{'num' defined here}}
71 template<int L
, class T
, class N
> T
test_template(T
* arr
, N num
) {
75 // Negative number is passed as L.
79 #pragma omp distribute parallel for simd aligned(arr:L) // expected-error {{argument to 'aligned' clause must be a strictly positive integer value}}
80 for (i
= 0; i
< num
; ++i
) {
81 T cur
= arr
[(int)ind2
];
88 #pragma omp distribute parallel for simd aligned(num:4) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
89 for (i
= 0; i
< num
; ++i
);
94 template<int LEN
> int test_warn() {
98 #pragma omp distribute parallel for simd aligned(ind2:LEN) // expected-error {{argument to 'aligned' clause must be a strictly positive integer value}}
99 for (int i
= 0; i
< 100; i
++) {
105 struct S1
; // expected-note 2 {{declared here}} // expected-note {{forward declaration of 'S1'}}
106 extern S1 a
; // expected-note {{'a' declared here}}
112 const S2 b
; // expected-note 1 {{'b' defined here}}
133 S3 h
; // expected-note 2 {{'h' defined here}}
134 #pragma omp threadprivate(h)
136 template<class I
, class C
> int foomain(I argc
, C
**argv
) {
139 int i
; // expected-note {{'i' defined here}}
140 // expected-note@+1 {{declared here}}
145 #pragma omp distribute parallel for simd aligned // expected-error {{expected '(' after 'aligned'}}
146 for (I k
= 0; k
< argc
; ++k
) ++k
;
150 #pragma omp distribute parallel for simd aligned ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
151 for (I k
= 0; k
< argc
; ++k
) ++k
;
155 #pragma omp distribute parallel for simd aligned () // expected-error {{expected expression}}
156 for (I k
= 0; k
< argc
; ++k
) ++k
;
160 #pragma omp distribute parallel for simd aligned (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
161 for (I k
= 0; k
< argc
; ++k
) ++k
;
165 #pragma omp distribute parallel for simd aligned (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
166 for (I k
= 0; k
< argc
; ++k
) ++k
;
170 // FIXME: Should argc really be a pointer?
171 #pragma omp distribute parallel for simd aligned (*argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
172 for (I k
= 0; k
< argc
; ++k
) ++k
;
176 #pragma omp distribute parallel for simd aligned (argc : 5) // expected-warning {{aligned clause will be ignored because the requested alignment is not a power of 2}}
177 for (I k
= 0; k
< argc
; ++k
) ++k
;
181 #pragma omp distribute parallel for simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
182 for (I k
= 0; k
< argc
; ++k
) ++k
;
186 #pragma omp distribute parallel for simd aligned (argv[1]) // expected-error {{expected variable name}}
187 for (I k
= 0; k
< argc
; ++k
) ++k
;
191 #pragma omp distribute parallel for simd aligned(e, g)
192 for (I k
= 0; k
< argc
; ++k
) ++k
;
196 #pragma omp distribute parallel for simd aligned(h) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S3'}}
197 for (I k
= 0; k
< argc
; ++k
) ++k
;
201 #pragma omp distribute parallel for simd aligned(i) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
202 for (I k
= 0; k
< argc
; ++k
) ++k
;
210 #pragma omp distribute parallel for simd aligned(v:16)
211 for (I k
= 0; k
< argc
; ++k
) { i
= k
; v
+= 2; }
217 #pragma omp distribute parallel for simd aligned(f)
218 for (I k
= 0; k
< argc
; ++k
) ++k
;
224 #pragma omp distribute parallel for simd aligned(f:j) // expected-note {{initializer of 'j' is not a constant expression}} expected-error {{integral constant expression}}
226 for (I k
= 0; k
< argc
; ++k
) { ++k
; v
+= j
; }
230 #pragma omp distribute parallel for simd aligned(f)
231 for (I k
= 0; k
< argc
; ++k
) ++k
;
236 // expected-note@+1 2 {{'argc' defined here}}
237 int main(int argc
, char **argv
) {
239 // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
240 test_template
<-4>(darr
, 4);
241 test_warn
<4>(); // ok
242 // expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}}
250 #pragma omp distribute parallel for simd aligned // expected-error {{expected '(' after 'aligned'}}
251 for (int k
= 0; k
< argc
; ++k
) ++k
;
255 #pragma omp distribute parallel for simd aligned ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
256 for (int k
= 0; k
< argc
; ++k
) ++k
;
260 #pragma omp distribute parallel for simd aligned () // expected-error {{expected expression}}
261 for (int k
= 0; k
< argc
; ++k
) ++k
;
265 #pragma omp distribute parallel for simd aligned (argv // expected-error {{expected ')'}} expected-note {{to match this '('}}
266 for (int k
= 0; k
< argc
; ++k
) ++k
;
270 #pragma omp distribute parallel for simd aligned (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
271 for (int k
= 0; k
< argc
; ++k
) ++k
;
275 #pragma omp distribute parallel for simd aligned (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
276 for (int k
= 0; k
< argc
; ++k
) ++k
;
280 #pragma omp distribute parallel for simd aligned (argc) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
281 for (int k
= 0; k
< argc
; ++k
) ++k
;
285 #pragma omp distribute parallel for simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
286 for (int k
= 0; k
< argc
; ++k
) ++k
;
290 #pragma omp distribute parallel for simd aligned (a, b) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S1'}} expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}}
291 for (int k
= 0; k
< argc
; ++k
) ++k
;
295 #pragma omp distribute parallel for simd aligned (argv[1]) // expected-error {{expected variable name}}
296 for (int k
= 0; k
< argc
; ++k
) ++k
;
300 #pragma omp distribute parallel for simd aligned(h) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S3'}}
301 for (int k
= 0; k
< argc
; ++k
) ++k
;
304 // expected-note@+1 {{in instantiation of function template specialization 'foomain<int *, char>' requested here}}
305 foomain
<int*,char>(pargc
,argv
);