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
)
22 #pragma omp teams distribute parallel for simd aligned(B:bfoo())
23 for (int i
= 0; i
< 10; ++i
) ;
26 #pragma omp teams distribute parallel for simd aligned(B::ib:B:bfoo()) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'}}
27 for (int i
= 0; i
< 10; ++i
) ;
30 #pragma omp teams distribute parallel for simd aligned(B:B::bfoo())
31 for (int i
= 0; i
< 10; ++i
) ;
34 #pragma omp teams distribute parallel for simd aligned(z:B:bfoo()) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}}
35 for (int i
= 0; i
< 10; ++i
) ;
38 #pragma omp teams distribute parallel for simd aligned(B:B::bfoo())
39 for (int i
= 0; i
< 10; ++i
) ;
42 #pragma omp teams 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'}}
43 for (int i
= 0; i
< 10; ++i
) ;
46 #pragma omp teams distribute parallel for simd aligned(B,rp,::z: X::x) // expected-error {{integral constant expression must have integral or unscoped enumeration type, not 'B'}}
47 for (int i
= 0; i
< 10; ++i
) ;
50 #pragma omp teams distribute parallel for simd aligned(::z)
51 for (int i
= 0; i
< 10; ++i
) ;
54 #pragma omp teams distribute parallel for simd aligned(B::bfoo()) // expected-error {{expected variable name}}
55 for (int i
= 0; i
< 10; ++i
) ;
58 #pragma omp teams 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}}
59 for (int i
= 0; i
< 10; ++i
) ;
62 // expected-note@+1 {{'num' defined here}}
63 template<int L
, class T
, class N
> T
test_template(T
* arr
, N num
) {
67 // Negative number is passed as L.
70 #pragma omp teams distribute parallel for simd aligned(arr:L) // expected-error {{argument to 'aligned' clause must be a strictly positive integer value}}
71 for (i
= 0; i
< num
; ++i
) {
72 T cur
= arr
[(int)ind2
];
78 #pragma omp teams 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'}}
79 for (i
= 0; i
< num
; ++i
);
84 template<int LEN
> int test_warn() {
87 #pragma omp teams distribute parallel for simd aligned(ind2:LEN) // expected-error {{argument to 'aligned' clause must be a strictly positive integer value}}
88 for (int i
= 0; i
< 100; i
++) {
94 struct S1
; // expected-note 2 {{declared here}} // expected-note {{forward declaration of 'S1'}}
95 extern S1 a
; // expected-note {{'a' declared here}}
101 const S2 b
; // expected-note 1 {{'b' defined here}}
122 S3 h
; // expected-note 2 {{'h' defined here}}
123 #pragma omp threadprivate(h)
125 template<class I
, class C
> int foomain(I argc
, C
**argv
) {
128 int i
; // expected-note {{'i' defined here}}
129 // expected-note@+1 {{declared here}}
133 #pragma omp teams distribute parallel for simd aligned // expected-error {{expected '(' after 'aligned'}}
134 for (I k
= 0; k
< argc
; ++k
) ++k
;
137 #pragma omp teams distribute parallel for simd aligned ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
138 for (I k
= 0; k
< argc
; ++k
) ++k
;
141 #pragma omp teams distribute parallel for simd aligned () // expected-error {{expected expression}}
142 for (I k
= 0; k
< argc
; ++k
) ++k
;
145 #pragma omp teams distribute parallel for simd aligned (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
146 for (I k
= 0; k
< argc
; ++k
) ++k
;
149 #pragma omp teams distribute parallel for simd aligned (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
150 for (I k
= 0; k
< argc
; ++k
) ++k
;
152 // FIXME: Should argc really be a pointer?
154 #pragma omp teams distribute parallel for simd aligned (*argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
155 for (I k
= 0; k
< argc
; ++k
) ++k
;
158 #pragma omp teams distribute parallel for simd aligned (argc : 5) // expected-warning {{aligned clause will be ignored because the requested alignment is not a power of 2}}
159 for (I k
= 0; k
< argc
; ++k
) ++k
;
162 #pragma omp teams distribute parallel for simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
163 for (I k
= 0; k
< argc
; ++k
) ++k
;
166 #pragma omp teams distribute parallel for simd aligned (argv[1]) // expected-error {{expected variable name}}
167 for (I k
= 0; k
< argc
; ++k
) ++k
;
170 #pragma omp teams distribute parallel for simd aligned(e, g)
171 for (I k
= 0; k
< argc
; ++k
) ++k
;
174 #pragma omp teams 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'}}
175 for (I k
= 0; k
< argc
; ++k
) ++k
;
178 #pragma omp teams 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'}}
179 for (I k
= 0; k
< argc
; ++k
) ++k
;
186 #pragma omp teams distribute parallel for simd aligned(v:16)
187 for (I k
= 0; k
< argc
; ++k
) { i
= k
; v
+= 2; }
192 #pragma omp teams distribute parallel for simd aligned(f)
193 for (I k
= 0; k
< argc
; ++k
) ++k
;
198 #pragma omp teams distribute parallel for simd aligned(f:j) // expected-note {{initializer of 'j' is not a constant expression}} expected-error {{integral constant expression}}
200 for (I k
= 0; k
< argc
; ++k
) { ++k
; v
+= j
; }
203 #pragma omp teams distribute parallel for simd aligned(f)
204 for (I k
= 0; k
< argc
; ++k
) ++k
;
209 // expected-note@+1 2 {{'argc' defined here}}
210 int main(int argc
, char **argv
) {
212 // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
213 test_template
<-4>(darr
, 4);
214 test_warn
<4>(); // ok
215 // expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}}
222 #pragma omp teams distribute parallel for simd aligned // expected-error {{expected '(' after 'aligned'}}
223 for (int k
= 0; k
< argc
; ++k
) ++k
;
226 #pragma omp teams distribute parallel for simd aligned ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
227 for (int k
= 0; k
< argc
; ++k
) ++k
;
230 #pragma omp teams distribute parallel for simd aligned () // expected-error {{expected expression}}
231 for (int k
= 0; k
< argc
; ++k
) ++k
;
234 #pragma omp teams distribute parallel for simd aligned (argv // expected-error {{expected ')'}} expected-note {{to match this '('}}
235 for (int k
= 0; k
< argc
; ++k
) ++k
;
238 #pragma omp teams 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'}}
239 for (int k
= 0; k
< argc
; ++k
) ++k
;
243 #pragma omp distribute simd aligned (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
244 for (int k
= 0; k
< argc
; ++k
) ++k
;
248 #pragma omp distribute simd aligned (argc) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
249 for (int k
= 0; k
< argc
; ++k
) ++k
;
252 #pragma omp teams distribute parallel for simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
253 for (int k
= 0; k
< argc
; ++k
) ++k
;
256 #pragma omp teams 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}}
257 for (int k
= 0; k
< argc
; ++k
) ++k
;
260 #pragma omp teams distribute parallel for simd aligned (argv[1]) // expected-error {{expected variable name}}
261 for (int k
= 0; k
< argc
; ++k
) ++k
;
264 #pragma omp teams 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'}}
265 for (int k
= 0; k
< argc
; ++k
) ++k
;
268 // expected-note@+1 {{in instantiation of function template specialization 'foomain<int *, char>' requested here}}
269 foomain
<int*,char>(pargc
,argv
);