1 // RUN: %clang_cc1 -verify -fopenmp %s
6 bool foobool(int argc) {
10 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
29 S4(); // expected-note {{implicitly declared private here}}
33 #pragma omp parallel sections private(a) private(this->a)
35 for (int k = 0; k < v; ++k)
42 S5() : a(0) {} // expected-note {{implicitly declared private here}}
46 S5 &operator=(S5 &s) {
47 #pragma omp parallel sections 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)
63 #pragma omp parallel sections private(a) private(this->a)
65 for (int k = 0; k < v; ++k)
69 S6 &operator=(S6 &s) {
70 #pragma omp parallel sections private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
72 for (int k = 0; k < s.a; ++k)
86 #pragma omp parallel sections private(a) private(this->a) private(T::a)
88 for (int k = 0; k < a.a; ++k)
92 S7 &operator=(S7 &s) {
93 #pragma omp parallel 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}}
95 for (int k = 0; k < s.a.a; ++k)
103 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
105 template <class I, class C>
106 int foomain(I argc, C **argv) {
111 #pragma omp parallel sections private // expected-error {{expected '(' after 'private'}}
115 #pragma omp parallel sections private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
119 #pragma omp parallel sections private() // expected-error {{expected expression}}
123 #pragma omp parallel sections private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
127 #pragma omp parallel sections private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
131 #pragma omp parallel sections private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
135 #pragma omp parallel sections private(argc)
139 #pragma omp parallel sections private(S1) // expected-error {{'S1' does not refer to a value}}
143 #pragma omp parallel sections private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
147 #pragma omp parallel sections private(argv[1]) // expected-error {{expected variable name}}
151 #pragma omp parallel sections private(e, g)
155 #pragma omp parallel sections private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
159 #pragma omp parallel sections copyprivate(h) // expected-error {{unexpected OpenMP clause 'copyprivate' in directive '#pragma omp parallel sections'}}
167 #pragma omp parallel sections private(i)
173 #pragma omp parallel shared(i)
174 #pragma omp parallel private(i)
175 #pragma omp parallel sections private(j)
179 #pragma omp parallel sections private(i)
188 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
194 int main(int argc, char **argv) {
197 S6<float> s6(0.0) , s6_0(1.0);
198 S7<S6<float> > s7(0.0) , s7_0(1.0);
201 #pragma omp parallel sections private // expected-error {{expected '(' after 'private'}}
205 #pragma omp parallel sections private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
209 #pragma omp parallel sections private() // expected-error {{expected expression}}
213 #pragma omp parallel sections private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
217 #pragma omp parallel sections private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
221 #pragma omp parallel sections private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
225 #pragma omp parallel sections private(argc)
229 #pragma omp parallel sections private(S1) // expected-error {{'S1' does not refer to a value}}
233 #pragma omp parallel sections private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
237 #pragma omp parallel sections private(argv[1]) // expected-error {{expected variable name}}
241 #pragma omp parallel sections private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
245 #pragma omp parallel sections private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
249 #pragma omp parallel sections copyprivate(h) // expected-error {{unexpected OpenMP clause 'copyprivate' in directive '#pragma omp parallel sections'}}
256 #pragma omp parallel sections private(i)
261 #pragma omp parallel shared(i)
262 #pragma omp parallel private(i)
263 #pragma omp parallel sections private(j)
267 #pragma omp parallel sections private(i)
272 #pragma omp parallel sections private(m)
277 s6 = s6_0; // expected-note {{in instantiation of member function 'S6<float>::operator=' requested here}}
278 s7 = s7_0; // expected-note {{in instantiation of member function 'S7<S6<float> >::operator=' requested here}}
279 return foomain(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}