xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/atomic_messages.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
2*0a6a1f1dSLionel Sambuc 
foo()3*0a6a1f1dSLionel Sambuc int foo() {
4*0a6a1f1dSLionel Sambuc L1:
5*0a6a1f1dSLionel Sambuc   foo();
6*0a6a1f1dSLionel Sambuc #pragma omp atomic
7*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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*0a6a1f1dSLionel Sambuc   {
9*0a6a1f1dSLionel Sambuc     foo();
10*0a6a1f1dSLionel Sambuc     goto L1; // expected-error {{use of undeclared label 'L1'}}
11*0a6a1f1dSLionel Sambuc   }
12*0a6a1f1dSLionel Sambuc   goto L2; // expected-error {{use of undeclared label 'L2'}}
13*0a6a1f1dSLionel Sambuc #pragma omp atomic
14*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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}}
15*0a6a1f1dSLionel Sambuc   {
16*0a6a1f1dSLionel Sambuc     foo();
17*0a6a1f1dSLionel Sambuc   L2:
18*0a6a1f1dSLionel Sambuc     foo();
19*0a6a1f1dSLionel Sambuc   }
20*0a6a1f1dSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc   return 0;
22*0a6a1f1dSLionel Sambuc }
23*0a6a1f1dSLionel Sambuc 
24*0a6a1f1dSLionel Sambuc struct S {
25*0a6a1f1dSLionel Sambuc   int a;
operator =S26*0a6a1f1dSLionel Sambuc   S &operator=(int v) {
27*0a6a1f1dSLionel Sambuc     a = v;
28*0a6a1f1dSLionel Sambuc     return *this;
29*0a6a1f1dSLionel Sambuc   }
operator +=S30*0a6a1f1dSLionel Sambuc   S &operator+=(const S &s) {
31*0a6a1f1dSLionel Sambuc     a += s.a;
32*0a6a1f1dSLionel Sambuc     return *this;
33*0a6a1f1dSLionel Sambuc   }
34*0a6a1f1dSLionel Sambuc };
35*0a6a1f1dSLionel Sambuc 
36*0a6a1f1dSLionel Sambuc template <class T>
read()37*0a6a1f1dSLionel Sambuc T read() {
38*0a6a1f1dSLionel Sambuc   T a = T(), b = T();
39*0a6a1f1dSLionel Sambuc // Test for atomic read
40*0a6a1f1dSLionel Sambuc #pragma omp atomic read
41*0a6a1f1dSLionel Sambuc   // 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}}
42*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected an expression statement}}
43*0a6a1f1dSLionel Sambuc   ;
44*0a6a1f1dSLionel Sambuc #pragma omp atomic read
45*0a6a1f1dSLionel Sambuc   // 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}}
46*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
47*0a6a1f1dSLionel Sambuc   foo();
48*0a6a1f1dSLionel Sambuc #pragma omp atomic read
49*0a6a1f1dSLionel Sambuc   // 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}}
50*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
51*0a6a1f1dSLionel Sambuc   a += b;
52*0a6a1f1dSLionel Sambuc #pragma omp atomic read
53*0a6a1f1dSLionel Sambuc   // 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}}
54*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected lvalue expression}}
55*0a6a1f1dSLionel Sambuc   a = 0;
56*0a6a1f1dSLionel Sambuc #pragma omp atomic read
57*0a6a1f1dSLionel Sambuc   // 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}}
58*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
59*0a6a1f1dSLionel Sambuc   a = b;
60*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
61*0a6a1f1dSLionel Sambuc #pragma omp atomic read read
62*0a6a1f1dSLionel Sambuc   // 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}}
63*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
64*0a6a1f1dSLionel Sambuc   a = b;
65*0a6a1f1dSLionel Sambuc 
66*0a6a1f1dSLionel Sambuc   return a;
67*0a6a1f1dSLionel Sambuc }
68*0a6a1f1dSLionel Sambuc 
read()69*0a6a1f1dSLionel Sambuc int read() {
70*0a6a1f1dSLionel Sambuc   int a = 0, b = 0;
71*0a6a1f1dSLionel Sambuc // Test for atomic read
72*0a6a1f1dSLionel Sambuc #pragma omp atomic read
73*0a6a1f1dSLionel Sambuc   // 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}}
74*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected an expression statement}}
75*0a6a1f1dSLionel Sambuc   ;
76*0a6a1f1dSLionel Sambuc #pragma omp atomic read
77*0a6a1f1dSLionel Sambuc   // 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}}
78*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
79*0a6a1f1dSLionel Sambuc   foo();
80*0a6a1f1dSLionel Sambuc #pragma omp atomic read
81*0a6a1f1dSLionel Sambuc   // 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}}
82*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
83*0a6a1f1dSLionel Sambuc   a += b;
84*0a6a1f1dSLionel Sambuc #pragma omp atomic read
85*0a6a1f1dSLionel Sambuc   // 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}}
86*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected lvalue expression}}
87*0a6a1f1dSLionel Sambuc   a = 0;
88*0a6a1f1dSLionel Sambuc #pragma omp atomic read
89*0a6a1f1dSLionel Sambuc   a = b;
90*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
91*0a6a1f1dSLionel Sambuc #pragma omp atomic read read
92*0a6a1f1dSLionel Sambuc   a = b;
93*0a6a1f1dSLionel Sambuc 
94*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{in instantiation of function template specialization 'read<S>' requested here}}
95*0a6a1f1dSLionel Sambuc   return read<int>() + read<S>().a;
96*0a6a1f1dSLionel Sambuc }
97*0a6a1f1dSLionel Sambuc 
98*0a6a1f1dSLionel Sambuc template <class T>
write()99*0a6a1f1dSLionel Sambuc T write() {
100*0a6a1f1dSLionel Sambuc   T a, b = 0;
101*0a6a1f1dSLionel Sambuc // Test for atomic write
102*0a6a1f1dSLionel Sambuc #pragma omp atomic write
103*0a6a1f1dSLionel Sambuc   // 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}}
104*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected an expression statement}}
105*0a6a1f1dSLionel Sambuc   ;
106*0a6a1f1dSLionel Sambuc // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'write' clause}}
107*0a6a1f1dSLionel Sambuc #pragma omp atomic write write
108*0a6a1f1dSLionel Sambuc   a = b;
109*0a6a1f1dSLionel Sambuc #pragma omp atomic write
110*0a6a1f1dSLionel Sambuc   // 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}}
111*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
112*0a6a1f1dSLionel Sambuc   foo();
113*0a6a1f1dSLionel Sambuc #pragma omp atomic write
114*0a6a1f1dSLionel Sambuc   // 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}}
115*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
116*0a6a1f1dSLionel Sambuc   a += b;
117*0a6a1f1dSLionel Sambuc #pragma omp atomic write
118*0a6a1f1dSLionel Sambuc   a = 0;
119*0a6a1f1dSLionel Sambuc #pragma omp atomic write
120*0a6a1f1dSLionel Sambuc   a = b;
121*0a6a1f1dSLionel Sambuc 
122*0a6a1f1dSLionel Sambuc   return T();
123*0a6a1f1dSLionel Sambuc }
124*0a6a1f1dSLionel Sambuc 
write()125*0a6a1f1dSLionel Sambuc int write() {
126*0a6a1f1dSLionel Sambuc   int a, b = 0;
127*0a6a1f1dSLionel Sambuc // Test for atomic write
128*0a6a1f1dSLionel Sambuc #pragma omp atomic write
129*0a6a1f1dSLionel Sambuc   // 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}}
130*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected an expression statement}}
131*0a6a1f1dSLionel Sambuc   ;
132*0a6a1f1dSLionel Sambuc // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'write' clause}}
133*0a6a1f1dSLionel Sambuc #pragma omp atomic write write
134*0a6a1f1dSLionel Sambuc   a = b;
135*0a6a1f1dSLionel Sambuc #pragma omp atomic write
136*0a6a1f1dSLionel Sambuc   // 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}}
137*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
138*0a6a1f1dSLionel Sambuc   foo();
139*0a6a1f1dSLionel Sambuc #pragma omp atomic write
140*0a6a1f1dSLionel Sambuc   // 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}}
141*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{expected built-in assignment operator}}
142*0a6a1f1dSLionel Sambuc   a += b;
143*0a6a1f1dSLionel Sambuc #pragma omp atomic write
144*0a6a1f1dSLionel Sambuc   a = 0;
145*0a6a1f1dSLionel Sambuc #pragma omp atomic write
146*0a6a1f1dSLionel Sambuc   a = foo();
147*0a6a1f1dSLionel Sambuc 
148*0a6a1f1dSLionel Sambuc   return write<int>();
149*0a6a1f1dSLionel Sambuc }
150*0a6a1f1dSLionel Sambuc 
151*0a6a1f1dSLionel Sambuc template <class T>
update()152*0a6a1f1dSLionel Sambuc T update() {
153*0a6a1f1dSLionel Sambuc   T a, b = 0;
154*0a6a1f1dSLionel Sambuc // Test for atomic update
155*0a6a1f1dSLionel Sambuc #pragma omp atomic update
156*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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}}
157*0a6a1f1dSLionel Sambuc   ;
158*0a6a1f1dSLionel Sambuc // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}}
159*0a6a1f1dSLionel Sambuc #pragma omp atomic update update
160*0a6a1f1dSLionel Sambuc   a += b;
161*0a6a1f1dSLionel Sambuc 
162*0a6a1f1dSLionel Sambuc #pragma omp atomic
163*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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}}
164*0a6a1f1dSLionel Sambuc   ;
165*0a6a1f1dSLionel Sambuc 
166*0a6a1f1dSLionel Sambuc   return T();
167*0a6a1f1dSLionel Sambuc }
168*0a6a1f1dSLionel Sambuc 
update()169*0a6a1f1dSLionel Sambuc int update() {
170*0a6a1f1dSLionel Sambuc   int a, b = 0;
171*0a6a1f1dSLionel Sambuc // Test for atomic update
172*0a6a1f1dSLionel Sambuc #pragma omp atomic update
173*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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*0a6a1f1dSLionel Sambuc   ;
175*0a6a1f1dSLionel Sambuc // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}}
176*0a6a1f1dSLionel Sambuc #pragma omp atomic update update
177*0a6a1f1dSLionel Sambuc   a += b;
178*0a6a1f1dSLionel Sambuc 
179*0a6a1f1dSLionel Sambuc #pragma omp atomic
180*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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}}
181*0a6a1f1dSLionel Sambuc   ;
182*0a6a1f1dSLionel Sambuc 
183*0a6a1f1dSLionel Sambuc   return update<int>();
184*0a6a1f1dSLionel Sambuc }
185*0a6a1f1dSLionel Sambuc 
186*0a6a1f1dSLionel Sambuc template <class T>
capture()187*0a6a1f1dSLionel Sambuc T capture() {
188*0a6a1f1dSLionel Sambuc   T a, b = 0;
189*0a6a1f1dSLionel Sambuc // Test for atomic capture
190*0a6a1f1dSLionel Sambuc #pragma omp atomic capture
191*0a6a1f1dSLionel Sambuc   // 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}}
192*0a6a1f1dSLionel Sambuc   ++a;
193*0a6a1f1dSLionel Sambuc #pragma omp atomic capture
194*0a6a1f1dSLionel Sambuc   // 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}}
195*0a6a1f1dSLionel Sambuc   ;
196*0a6a1f1dSLionel Sambuc // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'capture' clause}}
197*0a6a1f1dSLionel Sambuc #pragma omp atomic capture capture
198*0a6a1f1dSLionel Sambuc   a = ++b;
199*0a6a1f1dSLionel Sambuc 
200*0a6a1f1dSLionel Sambuc   return T();
201*0a6a1f1dSLionel Sambuc }
202*0a6a1f1dSLionel Sambuc 
capture()203*0a6a1f1dSLionel Sambuc int capture() {
204*0a6a1f1dSLionel Sambuc   int a, b = 0;
205*0a6a1f1dSLionel Sambuc // Test for atomic capture
206*0a6a1f1dSLionel Sambuc #pragma omp atomic capture
207*0a6a1f1dSLionel Sambuc   // 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}}
208*0a6a1f1dSLionel Sambuc   ++a;
209*0a6a1f1dSLionel Sambuc #pragma omp atomic capture
210*0a6a1f1dSLionel Sambuc   // 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}}
211*0a6a1f1dSLionel Sambuc   ;
212*0a6a1f1dSLionel Sambuc // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'capture' clause}}
213*0a6a1f1dSLionel Sambuc #pragma omp atomic capture capture
214*0a6a1f1dSLionel Sambuc   a = ++b;
215*0a6a1f1dSLionel Sambuc 
216*0a6a1f1dSLionel Sambuc   return capture<int>();
217*0a6a1f1dSLionel Sambuc }
218*0a6a1f1dSLionel Sambuc 
219*0a6a1f1dSLionel Sambuc template <class T>
seq_cst()220*0a6a1f1dSLionel Sambuc T seq_cst() {
221*0a6a1f1dSLionel Sambuc   T a, b = 0;
222*0a6a1f1dSLionel Sambuc // Test for atomic seq_cst
223*0a6a1f1dSLionel Sambuc #pragma omp atomic seq_cst
224*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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}}
225*0a6a1f1dSLionel Sambuc   ;
226*0a6a1f1dSLionel Sambuc // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' clause}}
227*0a6a1f1dSLionel Sambuc #pragma omp atomic seq_cst seq_cst
228*0a6a1f1dSLionel Sambuc   a += b;
229*0a6a1f1dSLionel Sambuc 
230*0a6a1f1dSLionel Sambuc #pragma omp atomic update seq_cst
231*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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}}
232*0a6a1f1dSLionel Sambuc   ;
233*0a6a1f1dSLionel Sambuc 
234*0a6a1f1dSLionel Sambuc   return T();
235*0a6a1f1dSLionel Sambuc }
236*0a6a1f1dSLionel Sambuc 
seq_cst()237*0a6a1f1dSLionel Sambuc int seq_cst() {
238*0a6a1f1dSLionel Sambuc   int a, b = 0;
239*0a6a1f1dSLionel Sambuc // Test for atomic seq_cst
240*0a6a1f1dSLionel Sambuc #pragma omp atomic seq_cst
241*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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}}
242*0a6a1f1dSLionel Sambuc   ;
243*0a6a1f1dSLionel Sambuc // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' clause}}
244*0a6a1f1dSLionel Sambuc #pragma omp atomic seq_cst seq_cst
245*0a6a1f1dSLionel Sambuc   a += b;
246*0a6a1f1dSLionel Sambuc 
247*0a6a1f1dSLionel Sambuc #pragma omp atomic update seq_cst
248*0a6a1f1dSLionel Sambuc   // expected-error@+1 {{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}}
249*0a6a1f1dSLionel Sambuc   ;
250*0a6a1f1dSLionel Sambuc 
251*0a6a1f1dSLionel Sambuc  return seq_cst<int>();
252*0a6a1f1dSLionel Sambuc }
253*0a6a1f1dSLionel Sambuc 
254*0a6a1f1dSLionel Sambuc template <class T>
mixed()255*0a6a1f1dSLionel Sambuc T mixed() {
256*0a6a1f1dSLionel Sambuc   T a, b = T();
257*0a6a1f1dSLionel Sambuc // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
258*0a6a1f1dSLionel Sambuc // expected-note@+1 2 {{'read' clause used here}}
259*0a6a1f1dSLionel Sambuc #pragma omp atomic read write
260*0a6a1f1dSLionel Sambuc   a = b;
261*0a6a1f1dSLionel Sambuc // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
262*0a6a1f1dSLionel Sambuc // expected-note@+1 2 {{'write' clause used here}}
263*0a6a1f1dSLionel Sambuc #pragma omp atomic write read
264*0a6a1f1dSLionel Sambuc   a = b;
265*0a6a1f1dSLionel Sambuc // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
266*0a6a1f1dSLionel Sambuc // expected-note@+1 2 {{'update' clause used here}}
267*0a6a1f1dSLionel Sambuc #pragma omp atomic update read
268*0a6a1f1dSLionel Sambuc   a += b;
269*0a6a1f1dSLionel Sambuc // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
270*0a6a1f1dSLionel Sambuc // expected-note@+1 2 {{'capture' clause used here}}
271*0a6a1f1dSLionel Sambuc #pragma omp atomic capture read
272*0a6a1f1dSLionel Sambuc   a = ++b;
273*0a6a1f1dSLionel Sambuc   return T();
274*0a6a1f1dSLionel Sambuc }
275*0a6a1f1dSLionel Sambuc 
mixed()276*0a6a1f1dSLionel Sambuc int mixed() {
277*0a6a1f1dSLionel Sambuc   int a, b = 0;
278*0a6a1f1dSLionel Sambuc // expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
279*0a6a1f1dSLionel Sambuc // expected-note@+1 {{'read' clause used here}}
280*0a6a1f1dSLionel Sambuc #pragma omp atomic read write
281*0a6a1f1dSLionel Sambuc   a = b;
282*0a6a1f1dSLionel Sambuc // expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
283*0a6a1f1dSLionel Sambuc // expected-note@+1 {{'write' clause used here}}
284*0a6a1f1dSLionel Sambuc #pragma omp atomic write read
285*0a6a1f1dSLionel Sambuc   a = b;
286*0a6a1f1dSLionel Sambuc // expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
287*0a6a1f1dSLionel Sambuc // expected-note@+1 {{'write' clause used here}}
288*0a6a1f1dSLionel Sambuc #pragma omp atomic write update
289*0a6a1f1dSLionel Sambuc   a = b;
290*0a6a1f1dSLionel Sambuc // expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}}
291*0a6a1f1dSLionel Sambuc // expected-note@+1 {{'write' clause used here}}
292*0a6a1f1dSLionel Sambuc #pragma omp atomic write capture
293*0a6a1f1dSLionel Sambuc   a = b;
294*0a6a1f1dSLionel Sambuc   // expected-note@+1 {{in instantiation of function template specialization 'mixed<int>' requested here}}
295*0a6a1f1dSLionel Sambuc   return mixed<int>();
296*0a6a1f1dSLionel Sambuc }
297*0a6a1f1dSLionel Sambuc 
298