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}}
36 #pragma omp parallel masked private(a) private(this->a)
38 for (int k
= 0; k
< v
; ++k
)
45 S5() : a(0) {} // expected-note {{implicitly declared private here}}
49 S5
&operator=(S5
&s
) {
50 #pragma omp parallel masked private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
52 for (int k
= 0; k
< s
.a
; ++k
)
66 #pragma omp parallel masked private(a) private(this->a)
68 for (int k
= 0; k
< v
; ++k
)
72 S6
&operator=(S6
&s
) {
73 #pragma omp parallel masked private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
75 for (int k
= 0; k
< s
.a
; ++k
)
89 #pragma omp parallel masked private(a) private(this->a) private(T::a)
91 for (int k
= 0; k
< a
.a
; ++k
)
95 S7
&operator=(S7
&s
) {
96 #pragma omp parallel masked private(a) private(this->a) private(s.a) private(s.T::a) // expected-error 2 {{expected variable name or data member of current class}}
98 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
) {
114 #pragma omp parallel masked private // expected-error {{expected '(' after 'private'}}
118 #pragma omp parallel masked private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
122 #pragma omp parallel masked private() // expected-error {{expected expression}}
126 #pragma omp parallel masked private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
130 #pragma omp parallel masked private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
134 #pragma omp parallel masked private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
138 #pragma omp parallel masked 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 '('}}
142 #pragma omp parallel masked private(S1) // expected-error {{'S1' does not refer to a value}}
146 #pragma omp parallel masked private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
150 #pragma omp parallel masked private(argv[1]) // expected-error {{expected variable name}}
154 #pragma omp parallel masked private(e, g, z)
158 #pragma omp parallel masked private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
162 #pragma omp parallel masked copyprivate(h) // expected-error {{unexpected OpenMP clause 'copyprivate' in directive '#pragma omp parallel masked'}}
170 #pragma omp parallel masked private(i)
176 #pragma omp parallel shared(i)
177 #pragma omp parallel private(i)
178 #pragma omp parallel masked private(j)
182 #pragma omp parallel masked private(i)
191 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
197 int main(int argc
, char **argv
) {
200 S6
<float> s6(0.0) , s6_0(1.0);
201 S7
<S6
<float> > s7(0.0) , s7_0(1.0);
204 #pragma omp parallel masked private // expected-error {{expected '(' after 'private'}}
208 #pragma omp parallel masked private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
212 #pragma omp parallel masked private() // expected-error {{expected expression}}
216 #pragma omp parallel masked private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
220 #pragma omp parallel masked private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
224 #pragma omp parallel masked private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
228 #pragma omp parallel masked private(argc, z)
232 #pragma omp parallel masked private(S1) // expected-error {{'S1' does not refer to a value}}
236 #pragma omp parallel masked private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
240 #pragma omp parallel masked private(argv[1]) // expected-error {{expected variable name}}
244 #pragma omp parallel masked private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
248 #pragma omp parallel masked private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
252 #pragma omp parallel masked copyprivate(h) // expected-error {{unexpected OpenMP clause 'copyprivate' in directive '#pragma omp parallel masked'}}
259 #pragma omp parallel masked private(i)
264 #pragma omp parallel shared(i)
265 #pragma omp parallel private(i)
266 #pragma omp parallel masked private(j)
270 #pragma omp parallel masked private(i)
275 #pragma omp parallel masked private(m)
280 s6
= s6_0
; // expected-note {{in instantiation of member function 'S6<float>::operator=' requested here}}
281 s7
= s7_0
; // expected-note {{in instantiation of member function 'S7<S6<float>>::operator=' requested here}}
282 return foomain(argc
, argv
); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}