1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
8 struct S1
; // expected-note 2 {{declared here}}
14 S2
&operator=(S2
&s2
) { return *this; }
21 S3
&operator=(S3
&s3
) { return *this; }
26 S4
&operator=(const S4
&s4
); // expected-note 3 {{implicitly declared private here}}
34 S5
&operator=(const S5
&s5
) { return *this; } // expected-note 3 {{implicitly declared private here}}
44 #pragma omp threadprivate(h, k, l, m)
46 template <class T
, class C
>
47 T
tmain(T argc
, C
**argv
) {
50 #pragma omp single copyprivate(z)
53 #pragma omp single copyprivate // expected-error {{expected '(' after 'copyprivate'}}
55 #pragma omp single copyprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
57 #pragma omp single copyprivate() // expected-error {{expected expression}}
59 #pragma omp single copyprivate(k // expected-error {{expected ')'}} expected-note {{to match this '('}}
61 #pragma omp single copyprivate(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
63 #pragma omp single copyprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
65 #pragma omp single copyprivate(l) // expected-error 2 {{'operator=' is a private member of 'S4'}}
67 #pragma omp single copyprivate(S1) // expected-error {{'S1' does not refer to a value}}
69 #pragma omp single copyprivate(argv[1]) // expected-error {{expected variable name}}
70 #pragma omp parallel // expected-note {{implicitly determined as shared}}
71 #pragma omp single copyprivate(i) // expected-error {{copyprivate variable must be threadprivate or private in the enclosing context}}
73 #pragma omp single copyprivate(m) // expected-error 2 {{'operator=' is a private member of 'S5'}}
75 #pragma omp parallel private(i)
77 #pragma omp single copyprivate(i)
80 #pragma omp parallel shared(i) // expected-note {{defined as shared}}
82 #pragma omp single copyprivate(i) // expected-error {{copyprivate variable must be threadprivate or private in the enclosing context}}
85 #pragma omp parallel private(i)
86 #pragma omp parallel default(shared) // expected-note {{implicitly determined as shared}}
88 #pragma omp single copyprivate(i) // expected-error {{copyprivate variable must be threadprivate or private in the enclosing context}}
91 #pragma omp parallel private(i)
92 #pragma omp parallel // expected-note {{implicitly determined as shared}}
94 #pragma omp single copyprivate(i) // expected-error {{copyprivate variable must be threadprivate or private in the enclosing context}}
98 #pragma omp single private(i) copyprivate(i) // expected-error {{private variable cannot be copyprivate}} expected-note {{defined as private}}
101 #pragma omp single firstprivate(i) copyprivate(i) // expected-error {{firstprivate variable cannot be copyprivate}} expected-note {{defined as firstprivate}}
103 #pragma omp parallel private(TA)
105 #pragma omp single copyprivate(TA)
112 void bar(S4 a
[2], int n
, int b
[n
]) {
113 #pragma omp single copyprivate(a, b)
119 #pragma omp threadprivate(x)
125 int main(int argc
, char **argv
) {
129 #pragma omp single copyprivate // expected-error {{expected '(' after 'copyprivate'}}
131 #pragma omp single copyprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
133 #pragma omp single copyprivate() // expected-error {{expected expression}}
135 #pragma omp single copyprivate(k // expected-error {{expected ')'}} expected-note {{to match this '('}}
137 #pragma omp single copyprivate(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
139 #pragma omp single copyprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
141 #pragma omp single copyprivate(l, B::x) // expected-error {{'operator=' is a private member of 'S4'}}
143 #pragma omp single copyprivate(S1) // expected-error {{'S1' does not refer to a value}}
145 #pragma omp single copyprivate(argv[1]) // expected-error {{expected variable name}}
146 #pragma omp parallel // expected-note {{implicitly determined as shared}}
147 #pragma omp single copyprivate(i) // expected-error {{copyprivate variable must be threadprivate or private in the enclosing context}}
149 #pragma omp single copyprivate(m) // expected-error {{'operator=' is a private member of 'S5'}}
151 #pragma omp parallel private(i, z)
153 #pragma omp single copyprivate(i, z)
156 #pragma omp parallel shared(i) // expected-note {{defined as shared}}
158 #pragma omp single copyprivate(i) // expected-error {{copyprivate variable must be threadprivate or private in the enclosing context}}
161 #pragma omp parallel private(i)
162 #pragma omp parallel default(shared) // expected-note {{implicitly determined as shared}}
164 #pragma omp single copyprivate(i) // expected-error {{copyprivate variable must be threadprivate or private in the enclosing context}}
167 #pragma omp parallel private(i)
168 #pragma omp parallel // expected-note {{implicitly determined as shared}}
170 #pragma omp single copyprivate(i) // expected-error {{copyprivate variable must be threadprivate or private in the enclosing context}}
174 #pragma omp single private(i) copyprivate(i) // expected-error {{private variable cannot be copyprivate}} expected-note {{defined as private}}
177 #pragma omp single firstprivate(i) copyprivate(i) // expected-error {{firstprivate variable cannot be copyprivate}} expected-note {{defined as firstprivate}}
179 #pragma omp single copyprivate(i) nowait // expected-error {{the 'copyprivate' clause must not be used with the 'nowait' clause}} expected-note {{'nowait' clause is here}}
181 #pragma omp parallel private(intA)
183 #pragma omp single copyprivate(intA)
187 return tmain(argc
, argv
); // expected-note {{in instantiation of function template specialization 'tmain<int, char>' requested here}}
190 extern void abort(void);
193 single(int a
, int b
) {
194 #pragma omp single copyprivate(a) copyprivate(b)