2 // { dg-options "-fopenmp" }
4 struct S { int s; S () : s (0) {} S (int x) : s (x) {} ~S () {} };
5 struct T { int t; T () : t (0) {} T (int x) : t (x) {} ~T () {} };
7 #pragma omp declare reduction (+: ::S: omp_out.s += omp_in.s)
8 #pragma omp declare reduction (*: S: omp_out.s *= omp_in.s) \
9 initializer (omp_priv (1))
10 #pragma omp declare reduction (foo: S: omp_out.s += omp_in.s)
17 #pragma omp declare reduction (+: T: omp_out.t += omp_in.t)
18 #pragma omp parallel reduction (+: t) reduction (foo: s) reduction (*: s2)
19 s.s = 1, t.t = 1, s2.s = 2;
20 #pragma omp parallel reduction (::operator +: s)
22 #pragma omp parallel reduction (+: s)
32 #pragma omp declare reduction (+: T: omp_out.t += omp_in.t)
33 #pragma omp parallel reduction (+: t) reduction (foo: s) reduction (*: s2)
34 s.s = 1, t.t = 1, s2.s = 2;
35 #pragma omp parallel reduction (::operator +: s)
37 #pragma omp parallel reduction (+: s)
49 #pragma omp declare reduction (foo: S: omp_out.s += omp_in.s) initializer (bar (omp_priv))
50 #pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) initializer (bar (omp_orig)) // { dg-error "one of the initializer call arguments should be" }
57 #pragma omp declare reduction (foo: T: omp_out.s += omp_in.s) initializer (bar (omp_priv))
58 #pragma omp declare reduction (bar: T: omp_out.s += omp_in.s) initializer (bar (omp_orig)) // { dg-error "one of the initializer call arguments should be" }
66 #pragma omp declare reduction (+: ::S: omp_out.s *= omp_in.s) // { dg-error "previous" }
67 #pragma omp declare reduction (+: S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
71 #pragma omp declare reduction (f5: S: omp_out.s *= omp_in.s) // { dg-error "previous" }
72 #pragma omp declare reduction (f5: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
80 #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-error "with" }
81 #pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
87 #pragma omp declare reduction (+: ::S: omp_out.s *= omp_in.s) // { dg-error "previous" }
88 #pragma omp declare reduction (+: T: omp_out.t += omp_in.t)
89 #pragma omp declare reduction (+: S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
90 #pragma omp declare reduction (n3: long: omp_out += omp_in) // { dg-error "previous" }
91 #pragma omp declare reduction (n3: long int: omp_out += omp_in) // { dg-error "redeclaration of" }
92 #pragma omp declare reduction (n3: short unsigned: omp_out += omp_in)
93 #pragma omp declare reduction (n3: short int: omp_out += omp_in)
97 #pragma omp declare reduction (f6: T: omp_out.t += omp_in.t)
98 #pragma omp declare reduction (f6: S: omp_out.s *= omp_in.s) // { dg-error "previous" }
99 #pragma omp declare reduction (f6: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
100 #pragma omp declare reduction (f6: long: omp_out += omp_in) // { dg-error "previous" }
101 #pragma omp declare reduction (f6: long int: omp_out += omp_in) // { dg-error "redeclaration of" }
102 #pragma omp declare reduction (f6: short unsigned: omp_out += omp_in)
103 #pragma omp declare reduction (f6: short int: omp_out += omp_in)
111 #pragma omp declare reduction (bar: T: omp_out.t += omp_in.t)
112 #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-error "with" }
113 #pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
114 #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-error "with" }
115 #pragma omp declare reduction (bar: long int: omp_out += omp_in) // { dg-error "cannot be overloaded" }
116 #pragma omp declare reduction (bar: short unsigned: omp_out += omp_in)
117 #pragma omp declare reduction (bar: short int: omp_out += omp_in)
123 template <typename T>
127 #pragma omp declare reduction (f7: T: omp_out.s *= omp_in.s) // { dg-error "previous" }
128 #pragma omp declare reduction (f7: T: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
132 template <typename T>
135 #pragma omp declare reduction (bar: T: omp_out.s *= omp_in.s) // { dg-error "with" }
136 #pragma omp declare reduction (bar: T: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
143 template <typename U>
147 #pragma omp declare reduction (f8: T: omp_out.t += omp_in.t)
148 #pragma omp declare reduction (f8: U: omp_out.s *= omp_in.s) // { dg-error "previous" }
149 #pragma omp declare reduction (f8: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
150 #pragma omp declare reduction (f8: long: omp_out += omp_in) // { dg-error "previous" }
151 #pragma omp declare reduction (f8: long int: omp_out += omp_in) // { dg-error "redeclaration of" }
152 #pragma omp declare reduction (f8: short unsigned: omp_out += omp_in)
153 #pragma omp declare reduction (f8: short int: omp_out += omp_in)
157 template <typename V>
161 #pragma omp declare reduction (bar: T: omp_out.t += omp_in.t)
162 #pragma omp declare reduction (bar: V: omp_out.s *= omp_in.s) // { dg-error "with" }
163 #pragma omp declare reduction (bar: V2: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
164 #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-error "with" }
165 #pragma omp declare reduction (bar: long int: omp_out += omp_in) // { dg-error "cannot be overloaded" }
166 #pragma omp declare reduction (bar: short unsigned: omp_out += omp_in)
167 #pragma omp declare reduction (bar: short int: omp_out += omp_in)
174 #pragma omp declare reduction (+: S: omp_out.s += omp_in.s) initializer (omp_priv) // { dg-error "invalid initializer clause" }
175 #pragma omp declare reduction (+: T: omp_out.t += omp_in.t) initializer (omp_priv ()) // { dg-error "invalid initializer clause" }
180 struct A { int a; A (); ~A (); };
181 struct B { int b; B (); ~B (); B (int); };
182 struct C : public A, B { int c; C (); ~C (); };
183 #pragma omp declare reduction (+:B:omp_out.b += omp_in.b) initializer (omp_priv (4))
188 #pragma omp parallel reduction (+:a) // { dg-error "user defined reduction with constructor initializer for base class" }