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 sections 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 sections 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 sections private(a) private(this->a)
68 for (int k
= 0; k
< v
; ++k
)
72 S6
&operator=(S6
&s
) {
73 #pragma omp sections 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 sections 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 sections 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 sections private // expected-error {{expected '(' after 'private'}}
118 #pragma omp sections private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
122 #pragma omp sections private() // expected-error {{expected expression}}
126 #pragma omp sections private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
130 #pragma omp sections private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
134 #pragma omp sections private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
138 #pragma omp sections 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 sections private(S1) // expected-error {{'S1' does not refer to a value}}
146 #pragma omp sections private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
150 #pragma omp sections private(argv[1]) // expected-error {{expected variable name}}
154 #pragma omp sections private(e, g)
158 #pragma omp sections private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
162 #pragma omp sections shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp sections'}}
170 #pragma omp sections private(i)
176 #pragma omp parallel shared(i)
177 #pragma omp parallel private(i)
178 #pragma omp sections private(j)
182 #pragma omp sections 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 sections private // expected-error {{expected '(' after 'private'}}
208 #pragma omp sections private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
212 #pragma omp sections private() // expected-error {{expected expression}}
216 #pragma omp sections private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
220 #pragma omp sections private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
224 #pragma omp sections private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
228 #pragma omp sections private(argc)
232 #pragma omp sections private(S1) // expected-error {{'S1' does not refer to a value}}
236 #pragma omp sections private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
240 #pragma omp sections private(argv[1]) // expected-error {{expected variable name}}
244 #pragma omp sections private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
248 #pragma omp sections private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
252 #pragma omp sections shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp sections'}}
259 #pragma omp sections private(i)
264 #pragma omp parallel shared(i)
265 #pragma omp parallel private(i)
266 #pragma omp sections private(j)
270 #pragma omp sections private(i)
275 #pragma omp sections 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}}