blob: b47fbbc5c41115f4d3551aeed406a6c5ff178476 [file] [log] [blame]
Alexey Bataev0162e452014-07-22 10:10:35 +00001// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
2
3int foo() {
Alexey Bataevf98b00c2014-07-23 02:27:21 +00004L1:
5 foo();
6#pragma omp atomic
Alexey Bataev1d160b12015-03-13 12:27:31 +00007 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
8 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev0162e452014-07-22 10:10:35 +00009 {
10 foo();
11 goto L1; // expected-error {{use of undeclared label 'L1'}}
12 }
13 goto L2; // expected-error {{use of undeclared label 'L2'}}
Alexey Bataevf98b00c2014-07-23 02:27:21 +000014#pragma omp atomic
Alexey Bataev1d160b12015-03-13 12:27:31 +000015 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
16 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev0162e452014-07-22 10:10:35 +000017 {
18 foo();
Alexey Bataevf98b00c2014-07-23 02:27:21 +000019 L2:
Alexey Bataev0162e452014-07-22 10:10:35 +000020 foo();
21 }
22
23 return 0;
24}
Alexey Bataevf98b00c2014-07-23 02:27:21 +000025
Alexey Bataev62cec442014-11-18 10:14:22 +000026struct S {
27 int a;
28 S &operator=(int v) {
29 a = v;
30 return *this;
31 }
32 S &operator+=(const S &s) {
33 a += s.a;
34 return *this;
35 }
36};
37
Alexey Bataevf98b00c2014-07-23 02:27:21 +000038template <class T>
39T read() {
Alexey Bataev62cec442014-11-18 10:14:22 +000040 T a = T(), b = T();
Alexey Bataevf98b00c2014-07-23 02:27:21 +000041// Test for atomic read
42#pragma omp atomic read
Alexey Bataev62cec442014-11-18 10:14:22 +000043 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
44 // expected-note@+1 {{expected an expression statement}}
Alexey Bataevf98b00c2014-07-23 02:27:21 +000045 ;
Alexey Bataev62cec442014-11-18 10:14:22 +000046#pragma omp atomic read
47 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
48 // expected-note@+1 {{expected built-in assignment operator}}
49 foo();
50#pragma omp atomic read
51 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
52 // expected-note@+1 {{expected built-in assignment operator}}
53 a += b;
54#pragma omp atomic read
55 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
56 // expected-note@+1 {{expected lvalue expression}}
57 a = 0;
58#pragma omp atomic read
59 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
60 // expected-note@+1 {{expected built-in assignment operator}}
61 a = b;
62 // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
Alexey Bataevf98b00c2014-07-23 02:27:21 +000063#pragma omp atomic read read
Alexey Bataev62cec442014-11-18 10:14:22 +000064 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
65 // expected-note@+1 {{expected built-in assignment operator}}
Alexey Bataevf98b00c2014-07-23 02:27:21 +000066 a = b;
67
Alexey Bataev62cec442014-11-18 10:14:22 +000068 return a;
Alexey Bataevf98b00c2014-07-23 02:27:21 +000069}
70
71int read() {
Alexey Bataev62cec442014-11-18 10:14:22 +000072 int a = 0, b = 0;
Alexey Bataevf98b00c2014-07-23 02:27:21 +000073// Test for atomic read
74#pragma omp atomic read
Alexey Bataev62cec442014-11-18 10:14:22 +000075 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
76 // expected-note@+1 {{expected an expression statement}}
Alexey Bataevf98b00c2014-07-23 02:27:21 +000077 ;
Alexey Bataev62cec442014-11-18 10:14:22 +000078#pragma omp atomic read
79 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
80 // expected-note@+1 {{expected built-in assignment operator}}
81 foo();
82#pragma omp atomic read
83 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
84 // expected-note@+1 {{expected built-in assignment operator}}
85 a += b;
86#pragma omp atomic read
87 // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
88 // expected-note@+1 {{expected lvalue expression}}
89 a = 0;
90#pragma omp atomic read
91 a = b;
92 // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
Alexey Bataevf98b00c2014-07-23 02:27:21 +000093#pragma omp atomic read read
94 a = b;
95
Alexey Bataev62cec442014-11-18 10:14:22 +000096 // expected-note@+1 {{in instantiation of function template specialization 'read<S>' requested here}}
97 return read<int>() + read<S>().a;
Alexey Bataevf98b00c2014-07-23 02:27:21 +000098}
Alexey Bataevdea47612014-07-23 07:46:59 +000099
100template <class T>
101T write() {
102 T a, b = 0;
103// Test for atomic write
104#pragma omp atomic write
Alexey Bataevf33eba62014-11-28 07:21:40 +0000105 // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
106 // expected-note@+1 {{expected an expression statement}}
Alexey Bataevdea47612014-07-23 07:46:59 +0000107 ;
108// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'write' clause}}
109#pragma omp atomic write write
110 a = b;
Alexey Bataevf33eba62014-11-28 07:21:40 +0000111#pragma omp atomic write
112 // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
113 // expected-note@+1 {{expected built-in assignment operator}}
114 foo();
115#pragma omp atomic write
116 // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
117 // expected-note@+1 {{expected built-in assignment operator}}
118 a += b;
119#pragma omp atomic write
120 a = 0;
121#pragma omp atomic write
122 a = b;
Alexey Bataevdea47612014-07-23 07:46:59 +0000123
124 return T();
125}
126
127int write() {
128 int a, b = 0;
129// Test for atomic write
130#pragma omp atomic write
Alexey Bataevf33eba62014-11-28 07:21:40 +0000131 // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
132 // expected-note@+1 {{expected an expression statement}}
Alexey Bataevdea47612014-07-23 07:46:59 +0000133 ;
134// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'write' clause}}
135#pragma omp atomic write write
136 a = b;
Alexey Bataevf33eba62014-11-28 07:21:40 +0000137#pragma omp atomic write
138 // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
139 // expected-note@+1 {{expected built-in assignment operator}}
140 foo();
141#pragma omp atomic write
142 // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
143 // expected-note@+1 {{expected built-in assignment operator}}
144 a += b;
145#pragma omp atomic write
146 a = 0;
147#pragma omp atomic write
148 a = foo();
Alexey Bataevdea47612014-07-23 07:46:59 +0000149
150 return write<int>();
151}
152
153template <class T>
Alexey Bataev67a4f222014-07-23 10:25:33 +0000154T update() {
155 T a, b = 0;
156// Test for atomic update
157#pragma omp atomic update
Alexey Bataev1d160b12015-03-13 12:27:31 +0000158 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
159 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev67a4f222014-07-23 10:25:33 +0000160 ;
161// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}}
162#pragma omp atomic update update
163 a += b;
Alexey Bataev1d160b12015-03-13 12:27:31 +0000164#pragma omp atomic
165 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
166 // expected-note@+1 {{expected built-in binary operator}}
167 a = b;
168#pragma omp atomic update
169 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
170 // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}}
171 a = b || a;
172#pragma omp atomic update
173 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
174 // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}}
175 a = a && b;
176#pragma omp atomic update
177 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
178 // expected-note@+1 {{expected in right hand side of expression}}
179 a = float(a) + b;
180#pragma omp atomic
181 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
182 // expected-note@+1 {{expected in right hand side of expression}}
183 a = 2 * b;
184#pragma omp atomic
185 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
186 // expected-note@+1 {{expected in right hand side of expression}}
187 a = b + *&a;
188#pragma omp atomic
189 *&a = b * *&a;
190#pragma omp atomic update
191 a++;
192#pragma omp atomic
193 ++a;
194#pragma omp atomic update
195 a--;
196#pragma omp atomic
197 --a;
198#pragma omp atomic update
199 a += b;
200#pragma omp atomic
201 a %= b;
202#pragma omp atomic update
203 a *= b;
204#pragma omp atomic
205 a -= b;
206#pragma omp atomic update
207 a /= b;
208#pragma omp atomic
209 a &= b;
210#pragma omp atomic update
211 a ^= b;
212#pragma omp atomic
213 a |= b;
214#pragma omp atomic update
215 a <<= b;
216#pragma omp atomic
217 a >>= b;
218#pragma omp atomic update
219 a = b + a;
220#pragma omp atomic
221 a = a * b;
222#pragma omp atomic update
223 a = b - a;
224#pragma omp atomic
225 a = a / b;
226#pragma omp atomic update
227 a = b & a;
228#pragma omp atomic
229 a = a ^ b;
230#pragma omp atomic update
231 a = b | a;
232#pragma omp atomic
233 a = a << b;
234#pragma omp atomic
235 a = b >> a;
Alexey Bataev67a4f222014-07-23 10:25:33 +0000236
237#pragma omp atomic
Alexey Bataev1d160b12015-03-13 12:27:31 +0000238 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
239 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev67a4f222014-07-23 10:25:33 +0000240 ;
241
242 return T();
243}
244
245int update() {
246 int a, b = 0;
247// Test for atomic update
248#pragma omp atomic update
Alexey Bataev1d160b12015-03-13 12:27:31 +0000249 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
250 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev67a4f222014-07-23 10:25:33 +0000251 ;
252// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}}
253#pragma omp atomic update update
254 a += b;
Alexey Bataev67a4f222014-07-23 10:25:33 +0000255#pragma omp atomic
Alexey Bataev1d160b12015-03-13 12:27:31 +0000256 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
257 // expected-note@+1 {{expected built-in binary operator}}
258 a = b;
259#pragma omp atomic update
260 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
261 // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}}
262 a = b || a;
263#pragma omp atomic update
264 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
265 // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}}
266 a = a && b;
267#pragma omp atomic update
268 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
269 // expected-note@+1 {{expected in right hand side of expression}}
270 a = float(a) + b;
271#pragma omp atomic
272 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
273 // expected-note@+1 {{expected in right hand side of expression}}
274 a = 2 * b;
275#pragma omp atomic
276 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
277 // expected-note@+1 {{expected in right hand side of expression}}
278 a = b + *&a;
279#pragma omp atomic update
280 a++;
281#pragma omp atomic
282 ++a;
283#pragma omp atomic update
284 a--;
285#pragma omp atomic
286 --a;
287#pragma omp atomic update
288 a += b;
289#pragma omp atomic
290 a %= b;
291#pragma omp atomic update
292 a *= b;
293#pragma omp atomic
294 a -= b;
295#pragma omp atomic update
296 a /= b;
297#pragma omp atomic
298 a &= b;
299#pragma omp atomic update
300 a ^= b;
301#pragma omp atomic
302 a |= b;
303#pragma omp atomic update
304 a <<= b;
305#pragma omp atomic
306 a >>= b;
307#pragma omp atomic update
308 a = b + a;
309#pragma omp atomic
310 a = a * b;
311#pragma omp atomic update
312 a = b - a;
313#pragma omp atomic
314 a = a / b;
315#pragma omp atomic update
316 a = b & a;
317#pragma omp atomic
318 a = a ^ b;
319#pragma omp atomic update
320 a = b | a;
321#pragma omp atomic
322 a = a << b;
323#pragma omp atomic
324 a = b >> a;
325#pragma omp atomic
326 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
327 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev67a4f222014-07-23 10:25:33 +0000328 ;
329
330 return update<int>();
331}
332
333template <class T>
Alexey Bataev459dec02014-07-24 06:46:57 +0000334T capture() {
335 T a, b = 0;
336// Test for atomic capture
337#pragma omp atomic capture
338 // expected-error@+1 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
339 ++a;
340#pragma omp atomic capture
341 // expected-error@+1 {{the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}', '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}', '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}' where x is an l-value expression with scalar type}}
342 ;
343// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'capture' clause}}
344#pragma omp atomic capture capture
345 a = ++b;
346
347 return T();
348}
349
350int capture() {
351 int a, b = 0;
352// Test for atomic capture
353#pragma omp atomic capture
354 // expected-error@+1 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
355 ++a;
356#pragma omp atomic capture
357 // expected-error@+1 {{the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}', '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}', '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}' where x is an l-value expression with scalar type}}
358 ;
359// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'capture' clause}}
360#pragma omp atomic capture capture
361 a = ++b;
362
363 return capture<int>();
364}
365
366template <class T>
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000367T seq_cst() {
368 T a, b = 0;
369// Test for atomic seq_cst
370#pragma omp atomic seq_cst
Alexey Bataev1d160b12015-03-13 12:27:31 +0000371 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
372 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000373 ;
374// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' clause}}
375#pragma omp atomic seq_cst seq_cst
376 a += b;
377
378#pragma omp atomic update seq_cst
Alexey Bataev1d160b12015-03-13 12:27:31 +0000379 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
380 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000381 ;
382
383 return T();
384}
385
386int seq_cst() {
387 int a, b = 0;
388// Test for atomic seq_cst
389#pragma omp atomic seq_cst
Alexey Bataev1d160b12015-03-13 12:27:31 +0000390 // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
391 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000392 ;
393// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' clause}}
394#pragma omp atomic seq_cst seq_cst
395 a += b;
396
397#pragma omp atomic update seq_cst
Alexey Bataev1d160b12015-03-13 12:27:31 +0000398 // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
399 // expected-note@+1 {{expected an expression statement}}
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000400 ;
401
402 return seq_cst<int>();
403}
404
405template <class T>
Alexey Bataevdea47612014-07-23 07:46:59 +0000406T mixed() {
407 T a, b = T();
408// expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
409// expected-note@+1 2 {{'read' clause used here}}
410#pragma omp atomic read write
411 a = b;
412// expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
413// expected-note@+1 2 {{'write' clause used here}}
414#pragma omp atomic write read
415 a = b;
Alexey Bataev67a4f222014-07-23 10:25:33 +0000416// expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
417// expected-note@+1 2 {{'update' clause used here}}
418#pragma omp atomic update read
419 a += b;
Alexey Bataev459dec02014-07-24 06:46:57 +0000420// expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
421// expected-note@+1 2 {{'capture' clause used here}}
422#pragma omp atomic capture read
423 a = ++b;
Alexey Bataevdea47612014-07-23 07:46:59 +0000424 return T();
425}
426
427int mixed() {
428 int a, b = 0;
429// expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
430// expected-note@+1 {{'read' clause used here}}
431#pragma omp atomic read write
432 a = b;
433// expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
434// expected-note@+1 {{'write' clause used here}}
435#pragma omp atomic write read
436 a = b;
Alexey Bataev67a4f222014-07-23 10:25:33 +0000437// expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
438// expected-note@+1 {{'write' clause used here}}
439#pragma omp atomic write update
440 a = b;
Alexey Bataev459dec02014-07-24 06:46:57 +0000441// expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
442// expected-note@+1 {{'write' clause used here}}
443#pragma omp atomic write capture
444 a = b;
445 // expected-note@+1 {{in instantiation of function template specialization 'mixed<int>' requested here}}
Alexey Bataevdea47612014-07-23 07:46:59 +0000446 return mixed<int>();
447}
448