1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
5 extern int omp_default_mem_alloc
;
9 bool foobool(int argc
) {
13 struct S1
; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
32 S4(); // expected-note {{implicitly declared private here}}
38 #pragma omp distribute simd private(a) private(this->a)
39 for (int k
= 0; k
< v
; ++k
)
45 S5() : a(0) {} // expected-note {{implicitly declared private here}}
49 S5
&operator=(S5
&s
) {
52 #pragma omp distribute simd private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
53 for (int k
= 0; k
< s
.a
; ++k
) // expected-warning {{type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
68 #pragma omp distribute simd private(a) private(this->a)
69 for (int k
= 0; k
< v
; ++k
)
72 S6
&operator=(S6
&s
) {
75 #pragma omp distribute simd private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
76 for (int k
= 0; k
< s
.a
; ++k
)
91 #pragma omp distribute simd private(a) private(this->a) private(T::a)
92 for (int k
= 0; k
< a
.a
; ++k
)
95 S7
&operator=(S7
&s
) {
98 #pragma omp distribute simd private(a) private(this->a) private(s.a) private(s.T::a) // expected-error 2 {{expected variable name or data member of current class}}
99 for (int k
= 0; k
< s
.a
.a
; ++k
)
106 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
108 template <class I
, class C
>
109 int foomain(I argc
, C
**argv
) {
116 #pragma omp distribute simd private // expected-error {{expected '(' after 'private'}}
117 for (int k
= 0; k
< argc
; ++k
)
121 #pragma omp distribute simd private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
122 for (int k
= 0; k
< argc
; ++k
)
126 #pragma omp distribute simd private() // expected-error {{expected expression}}
127 for (int k
= 0; k
< argc
; ++k
)
131 #pragma omp distribute simd private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
132 for (int k
= 0; k
< argc
; ++k
)
136 #pragma omp distribute simd private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
137 for (int k
= 0; k
< argc
; ++k
)
141 #pragma omp distribute simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
142 for (int k
= 0; k
< argc
; ++k
)
146 #pragma omp distribute simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
147 for (int k
= 0; k
< argc
; ++k
)
151 #pragma omp distribute simd private(S1) // expected-error {{'S1' does not refer to a value}}
152 for (int k
= 0; k
< argc
; ++k
)
156 #pragma omp distribute simd private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
157 for (int k
= 0; k
< argc
; ++k
)
161 #pragma omp distribute simd private(argv[1]) // expected-error {{expected variable name}}
162 for (int k
= 0; k
< argc
; ++k
)
166 #pragma omp distribute simd private(e, g)
167 for (int k
= 0; k
< argc
; ++k
)
171 #pragma omp distribute simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
172 for (int k
= 0; k
< argc
; ++k
)
176 #pragma omp distribute simd nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp distribute simd'}}
177 for (int k
= 0; k
< argc
; ++k
)
185 #pragma omp distribute simd private(i)
186 for (int k
= 0; k
< argc
; ++k
) {
191 #pragma omp parallel shared(i)
192 #pragma omp parallel private(i)
195 #pragma omp distribute simd private(j)
196 for (int k
= 0; k
< argc
; ++k
)
200 #pragma omp distribute simd private(i)
201 for (int k
= 0; k
< argc
; ++k
)
208 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
214 int main(int argc
, char **argv
) {
217 S6
<float> s6(0.0) , s6_0(1.0);
218 S7
<S6
<float> > s7(0.0) , s7_0(1.0);
223 #pragma omp distribute simd private // expected-error {{expected '(' after 'private'}}
224 for (int k
= 0; k
< argc
; ++k
)
228 #pragma omp distribute simd private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
229 for (int k
= 0; k
< argc
; ++k
)
233 #pragma omp distribute simd private() // expected-error {{expected expression}}
234 for (int k
= 0; k
< argc
; ++k
)
238 #pragma omp distribute simd private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
239 for (int k
= 0; k
< argc
; ++k
)
243 #pragma omp distribute simd private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
244 for (int k
= 0; k
< argc
; ++k
)
248 #pragma omp distribute simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
249 for (int k
= 0; k
< argc
; ++k
)
253 #pragma omp distribute simd private(argc)
254 for (int k
= 0; k
< argc
; ++k
)
258 #pragma omp distribute simd private(S1) // expected-error {{'S1' does not refer to a value}}
259 for (int k
= 0; k
< argc
; ++k
)
263 #pragma omp distribute simd private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
264 for (int k
= 0; k
< argc
; ++k
)
268 #pragma omp distribute simd private(argv[1]) // expected-error {{expected variable name}}
269 for (int k
= 0; k
< argc
; ++k
)
273 #pragma omp distribute simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
274 for (int k
= 0; k
< argc
; ++k
)
278 #pragma omp distribute simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
279 for (int k
= 0; k
< argc
; ++k
)
283 #pragma omp distribute simd nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp distribute simd'}}
284 for (int k
= 0; k
< argc
; ++k
)
291 #pragma omp distribute simd private(i)
292 for (int k
= 0; k
< argc
; ++k
)
295 #pragma omp parallel shared(i)
296 #pragma omp parallel private(i)
299 #pragma omp distribute simd private(j)
300 for (int k
= 0; k
< argc
; ++k
)
304 #pragma omp distribute simd private(i)
305 for (int k
= 0; k
< argc
; ++k
)
310 #pragma omp distribute simd private(m)
311 for (int k
= 0; k
< argc
; ++k
)
314 s6
= s6_0
; // expected-note {{in instantiation of member function 'S6<float>::operator=' requested here}}
315 s7
= s7_0
; // expected-note {{in instantiation of member function 'S7<S6<float>>::operator=' requested here}}
316 return foomain(argc
, argv
); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}