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 single private(a) private(this->a)
37 for (int k
= 0; k
< v
; ++k
)
43 S5() : a(0) {} // expected-note {{implicitly declared private here}}
47 S5
&operator=(S5
&s
) {
48 #pragma omp single private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
49 for (int k
= 0; k
< s
.a
; ++k
)
62 #pragma omp single private(a) private(this->a)
63 for (int k
= 0; k
< v
; ++k
)
66 S6
&operator=(S6
&s
) {
67 #pragma omp single private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
68 for (int k
= 0; k
< s
.a
; ++k
)
81 #pragma omp single private(a) private(this->a) private(T::a)
82 for (int k
= 0; k
< a
.a
; ++k
)
85 S7
&operator=(S7
&s
) {
86 #pragma omp single private(a) private(this->a) private(s.a) private(s.T::a) // expected-error 2 {{expected variable name or data member of current class}}
87 for (int k
= 0; k
< s
.a
.a
; ++k
)
94 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
96 template <class I
, class C
>
97 int foomain(I argc
, C
**argv
) {
102 #pragma omp single private // expected-error {{expected '(' after 'private'}}
104 #pragma omp single private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
106 #pragma omp single private() // expected-error {{expected expression}}
108 #pragma omp single private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
110 #pragma omp single private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
112 #pragma omp single private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
114 #pragma omp single 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 '('}}
116 #pragma omp single private(S1) // expected-error {{'S1' does not refer to a value}}
118 #pragma omp single private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
120 #pragma omp single private(argv[1]) // expected-error {{expected variable name}}
122 #pragma omp single private(e, g)
124 #pragma omp single private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
126 #pragma omp single shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp single'}}
132 #pragma omp single private(i)
136 #pragma omp parallel shared(i)
137 #pragma omp parallel private(i)
138 #pragma omp single private(j)
140 #pragma omp single private(i)
147 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
153 int main(int argc
, char **argv
) {
156 S6
<float> s6(0.0) , s6_0(1.0);
157 S7
<S6
<float> > s7(0.0) , s7_0(1.0);
160 #pragma omp single private // expected-error {{expected '(' after 'private'}}
162 #pragma omp single private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
164 #pragma omp single private() // expected-error {{expected expression}}
166 #pragma omp single private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
168 #pragma omp single private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
170 #pragma omp single private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
172 #pragma omp single private(argc)
174 #pragma omp single private(S1) // expected-error {{'S1' does not refer to a value}}
176 #pragma omp single private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
178 #pragma omp single private(argv[1]) // expected-error {{expected variable name}}
180 #pragma omp single private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
182 #pragma omp single private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
184 #pragma omp single shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp single'}}
189 #pragma omp single private(i)
192 #pragma omp parallel shared(i)
193 #pragma omp parallel private(i)
194 #pragma omp single private(j)
196 #pragma omp single private(i)
199 #pragma omp single private(m) // OK
202 s6
= s6_0
; // expected-note {{in instantiation of member function 'S6<float>::operator=' requested here}}
203 s7
= s7_0
; // expected-note {{in instantiation of member function 'S7<S6<float>>::operator=' requested here}}
204 return foomain(argc
, argv
); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}