1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-filecheck-ir-name _
2 // RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp %s -Wuninitialized
4 // RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp-simd %s -Wuninitialized
7 static int ib
[20]; // expected-note 0 {{'B::ib' declared here}}
8 static constexpr int bfoo() { return 8; }
11 B x
; // expected-note {{'x' defined here}}
13 constexpr int bfoo() { return 4; }
18 void test_aligned_colons(int *&rp
)
23 #pragma omp teams distribute simd aligned(B:bfoo())
24 for (int i
= 0; i
< 10; ++i
) ;
27 #pragma omp teams distribute simd aligned(B::ib:B:bfoo()) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'}}
28 for (int i
= 0; i
< 10; ++i
) ;
31 #pragma omp teams distribute simd aligned(B:B::bfoo())
32 for (int i
= 0; i
< 10; ++i
) ;
35 #pragma omp teams distribute simd aligned(z:B:bfoo()) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}}
36 for (int i
= 0; i
< 10; ++i
) ;
39 #pragma omp teams distribute simd aligned(B:B::bfoo())
40 for (int i
= 0; i
< 10; ++i
) ;
43 #pragma omp teams distribute 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'}}
44 for (int i
= 0; i
< 10; ++i
) ;
47 #pragma omp teams distribute simd aligned(B,rp,::z: X::x) // expected-error {{integral constant expression must have integral or unscoped enumeration type, not 'B'}}
48 for (int i
= 0; i
< 10; ++i
) ;
51 #pragma omp teams distribute simd aligned(::z)
52 for (int i
= 0; i
< 10; ++i
) ;
55 #pragma omp teams distribute simd aligned(B::bfoo()) // expected-error {{expected variable name}}
56 for (int i
= 0; i
< 10; ++i
) ;
59 #pragma omp teams distribute simd aligned(B::ib,B:C1+C2) // expected-warning {{aligned clause will be ignored because the requested alignment is not a power of 2}}
60 for (int i
= 0; i
< 10; ++i
) ;
63 // expected-note@+1 {{'num' defined here}}
64 template<int L
, class T
, class N
> T
test_template(T
* arr
, N num
) {
68 // Negative number is passed as L.
71 #pragma omp teams distribute simd aligned(arr:L) // expected-error {{argument to 'aligned' clause must be a strictly positive integer value}}
72 for (i
= 0; i
< num
; ++i
) {
73 T cur
= arr
[(int)ind2
];
79 #pragma omp teams distribute simd aligned(num:4) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
80 for (i
= 0; i
< num
; ++i
);
85 template<int LEN
> int test_warn() {
88 #pragma omp teams distribute simd aligned(ind2:LEN) // expected-error {{argument to 'aligned' clause must be a strictly positive integer value}}
89 for (int i
= 0; i
< 100; i
++) {
95 struct S1
; // expected-note 2 {{declared here}} // expected-note {{forward declaration of 'S1'}}
96 extern S1 a
; // expected-note {{'a' declared here}}
102 const S2 b
; // expected-note 1 {{'b' defined here}}
123 S3 h
; // expected-note 2 {{'h' defined here}}
124 #pragma omp threadprivate(h)
126 template<class I
, class C
> int foomain(I argc
, C
**argv
) {
129 int i
; // expected-note {{'i' defined here}}
130 // expected-note@+1 {{declared here}}
134 #pragma omp teams distribute simd aligned // expected-error {{expected '(' after 'aligned'}}
135 for (I k
= 0; k
< argc
; ++k
) ++k
;
138 #pragma omp teams distribute simd aligned ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
139 for (I k
= 0; k
< argc
; ++k
) ++k
;
142 #pragma omp teams distribute simd aligned () // expected-error {{expected expression}}
143 for (I k
= 0; k
< argc
; ++k
) ++k
;
146 #pragma omp teams distribute simd aligned (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
147 for (I k
= 0; k
< argc
; ++k
) ++k
;
150 #pragma omp teams distribute simd aligned (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
151 for (I k
= 0; k
< argc
; ++k
) ++k
;
153 // FIXME: Should argc really be a pointer?
155 #pragma omp teams distribute simd aligned (*argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
156 for (I k
= 0; k
< argc
; ++k
) ++k
;
159 #pragma omp teams distribute simd aligned (argc : 5) // expected-warning {{aligned clause will be ignored because the requested alignment is not a power of 2}}
160 for (I k
= 0; k
< argc
; ++k
) ++k
;
163 #pragma omp teams distribute simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
164 for (I k
= 0; k
< argc
; ++k
) ++k
;
167 #pragma omp teams distribute simd aligned (argv[1]) // expected-error {{expected variable name}}
168 for (I k
= 0; k
< argc
; ++k
) ++k
;
171 #pragma omp teams distribute simd aligned(e, g)
172 for (I k
= 0; k
< argc
; ++k
) ++k
;
175 #pragma omp teams distribute simd aligned(h) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S3'}}
176 for (I k
= 0; k
< argc
; ++k
) ++k
;
179 #pragma omp teams distribute simd aligned(i) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
180 for (I k
= 0; k
< argc
; ++k
) ++k
;
187 #pragma omp teams distribute simd aligned(v:16)
188 for (I k
= 0; k
< argc
; ++k
) { i
= k
; v
+= 2; }
193 #pragma omp teams distribute simd aligned(f)
194 for (I k
= 0; k
< argc
; ++k
) ++k
;
199 #pragma omp teams distribute simd aligned(f:j) // expected-note {{initializer of 'j' is not a constant expression}} expected-error {{integral constant expression}}
201 for (I k
= 0; k
< argc
; ++k
) { ++k
; v
+= j
; }
204 #pragma omp teams distribute simd aligned(f)
205 for (I k
= 0; k
< argc
; ++k
) ++k
;
210 // expected-note@+1 2 {{'argc' defined here}}
211 int main(int argc
, char **argv
) {
213 // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
214 test_template
<-4>(darr
, 4);
215 test_warn
<4>(); // ok
216 // expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}}
223 #pragma omp teams distribute simd aligned // expected-error {{expected '(' after 'aligned'}}
224 for (int k
= 0; k
< argc
; ++k
) ++k
;
227 #pragma omp teams distribute simd aligned ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
228 for (int k
= 0; k
< argc
; ++k
) ++k
;
231 #pragma omp teams distribute simd aligned () // expected-error {{expected expression}}
232 for (int k
= 0; k
< argc
; ++k
) ++k
;
235 #pragma omp teams distribute simd aligned (argv // expected-error {{expected ')'}} expected-note {{to match this '('}}
236 for (int k
= 0; k
< argc
; ++k
) ++k
;
239 #pragma omp teams distribute 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'}}
240 for (int k
= 0; k
< argc
; ++k
) ++k
;
244 #pragma omp distribute simd aligned (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
245 for (int k
= 0; k
< argc
; ++k
) ++k
;
249 #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'}}
250 for (int k
= 0; k
< argc
; ++k
) ++k
;
253 #pragma omp teams distribute simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
254 for (int k
= 0; k
< argc
; ++k
) ++k
;
257 #pragma omp teams distribute 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}}
258 for (int k
= 0; k
< argc
; ++k
) ++k
;
261 #pragma omp teams distribute simd aligned (argv[1]) // expected-error {{expected variable name}}
262 for (int k
= 0; k
< argc
; ++k
) ++k
;
265 #pragma omp teams distribute simd aligned(h) // expected-error {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S3'}}
266 for (int k
= 0; k
< argc
; ++k
) ++k
;
269 // expected-note@+1 {{in instantiation of function template specialization 'foomain<int *, char>' requested here}}
270 foomain
<int*,char>(pargc
,argv
);