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'}}
30 S4(); // expected-note {{implicitly declared private here}}
33 #pragma omp simd private(a) private(this->a)
34 for (int k
= 0; k
< v
; ++k
)
40 S5():a(0) {} // expected-note {{implicitly declared private here}}
43 S5
&operator=(S5
&s
) {
44 #pragma omp simd private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
45 for (int k
= 0; k
< s
.a
; ++k
)
58 #pragma omp simd private(a) private(this->a)
59 for (int k
= 0; k
< v
; ++k
)
62 S6
&operator=(S6
&s
) {
63 #pragma omp simd private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
64 for (int k
= 0; k
< s
.a
; ++k
)
77 #pragma omp simd private(a) private(this->a) private(T::a)
78 for (int k
= 0; k
< a
.a
; ++k
)
81 S7
&operator=(S7
&s
) {
82 #pragma omp simd private(a) private(this->a) private(s.a) private(s.T::a) // expected-error 2 {{expected variable name or data member of current class}}
83 for (int k
= 0; k
< s
.a
.a
; ++k
)
90 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
92 template<class I
, class C
> int foomain(I argc
, C
**argv
) {
97 #pragma omp simd private // expected-error {{expected '(' after 'private'}}
98 for (int k
= 0; k
< argc
; ++k
) ++k
;
99 #pragma omp simd private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
100 for (int k
= 0; k
< argc
; ++k
) ++k
;
101 #pragma omp simd private () // expected-error {{expected expression}}
102 for (int k
= 0; k
< argc
; ++k
) ++k
;
103 #pragma omp simd private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
104 for (int k
= 0; k
< argc
; ++k
) ++k
;
105 #pragma omp simd private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
106 for (int k
= 0; k
< argc
; ++k
) ++k
;
107 #pragma omp simd private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
108 for (int k
= 0; k
< argc
; ++k
) ++k
;
109 #pragma omp simd 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 '('}}
110 for (int k
= 0; k
< argc
; ++k
) ++k
;
111 #pragma omp simd private (S1) // expected-error {{'S1' does not refer to a value}}
112 for (int k
= 0; k
< argc
; ++k
) ++k
;
113 #pragma omp simd private (a, b) // expected-error {{private variable with incomplete type 'S1'}}
114 for (int k
= 0; k
< argc
; ++k
) ++k
;
115 #pragma omp simd private (argv[1]) // expected-error {{expected variable name}}
116 for (int k
= 0; k
< argc
; ++k
) ++k
;
117 #pragma omp simd private(e, g)
118 for (int k
= 0; k
< argc
; ++k
) ++k
;
119 #pragma omp simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
120 for (int k
= 0; k
< argc
; ++k
) ++k
;
121 #pragma omp simd shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp simd'}}
122 for (int k
= 0; k
< argc
; ++k
) ++k
;
127 #pragma omp simd private(i)
128 for (int k
= 0; k
< argc
; ++k
) { i
= k
; v
+= i
; }
130 #pragma omp parallel shared(i)
131 #pragma omp parallel private(i)
132 #pragma omp simd private(j)
133 for (int k
= 0; k
< argc
; ++k
) ++k
;
134 #pragma omp simd private(i)
135 for (int k
= 0; k
< argc
; ++k
) ++k
;
141 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
147 int main(int argc
, char **argv
) {
150 S6
<float> s6(0.0) , s6_0(1.0);
151 S7
<S6
<float> > s7(0.0) , s7_0(1.0);
154 #pragma omp simd private // expected-error {{expected '(' after 'private'}}
155 for (int k
= 0; k
< argc
; ++k
) ++k
;
156 #pragma omp simd private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
157 for (int k
= 0; k
< argc
; ++k
) ++k
;
158 #pragma omp simd private () // expected-error {{expected expression}}
159 for (int k
= 0; k
< argc
; ++k
) ++k
;
160 #pragma omp simd private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
161 for (int k
= 0; k
< argc
; ++k
) ++k
;
162 #pragma omp simd private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
163 for (int k
= 0; k
< argc
; ++k
) ++k
;
164 #pragma omp simd private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
165 for (int k
= 0; k
< argc
; ++k
) ++k
;
166 #pragma omp simd private (argc)
167 for (int k
= 0; k
< argc
; ++k
) ++k
;
168 #pragma omp simd private (S1) // expected-error {{'S1' does not refer to a value}}
169 for (int k
= 0; k
< argc
; ++k
) ++k
;
170 #pragma omp simd private (a, b) // expected-error {{private variable with incomplete type 'S1'}}
171 for (int k
= 0; k
< argc
; ++k
) ++k
;
172 #pragma omp simd private (argv[1]) // expected-error {{expected variable name}}
173 for (int k
= 0; k
< argc
; ++k
) ++k
;
174 #pragma omp simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
175 for (int k
= 0; k
< argc
; ++k
) ++k
;
176 #pragma omp simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
177 for (int k
= 0; k
< argc
; ++k
) ++k
;
178 #pragma omp simd shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp simd'}}
179 for (int k
= 0; k
< argc
; ++k
) ++k
;
183 #pragma omp simd private(i)
184 for (int k
= 0; k
< argc
; ++k
) ++k
;
186 #pragma omp parallel shared(i)
187 #pragma omp parallel private(i)
188 #pragma omp simd private(j)
189 for (int k
= 0; k
< argc
; ++k
) ++k
;
190 #pragma omp simd private(i)
191 for (int k
= 0; k
< argc
; ++k
) ++k
;
193 s6
= s6_0
; // expected-note {{in instantiation of member function 'S6<float>::operator=' requested here}}
194 s7
= s7_0
; // expected-note {{in instantiation of member function 'S7<S6<float>>::operator=' requested here}}
195 return foomain(argc
, argv
); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}