1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2017-2020 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* Code for operator() tests. */
22 struct test_unique_op_call
24 void operator() (int);
28 test_unique_op_call::operator() (int)
34 void operator() (int);
35 void operator() (long);
38 void operator() (T
*);
42 test_op_call::operator() (int)
46 test_op_call::operator() ()
50 test_op_call::operator() (long)
55 test_op_call::operator() (T
*t
)
59 /* Code for operator[] tests. */
61 struct test_unique_op_array
63 void operator[] (int);
67 test_unique_op_array::operator[] (int)
72 void operator[] (int);
73 void operator[] (long);
76 void operator[] (T
*);
80 test_op_array::operator[] (int)
84 test_op_array::operator[] (long)
89 test_op_array::operator[] (T
*t
)
92 /* Code for operator new tests. */
96 void *operator new (size_t);
100 test_op_new::operator new (size_t)
105 /* Code for operator delete tests. */
107 struct test_op_delete
109 void operator delete (void *);
113 test_op_delete::operator delete (void *)
117 /* Code for operator new[] tests. */
119 struct test_op_new_array
121 void *operator new[] (size_t);
125 test_op_new_array::operator new[] (size_t)
130 /* Code for operator delete[] tests. */
132 struct test_op_delete_array
134 void operator delete[] (void *);
138 test_op_delete_array::operator delete[] (void *)
142 /* Code for user-defined conversion tests. */
144 struct test_op_conversion_res
;
146 struct test_op_conversion
148 operator const volatile test_op_conversion_res
**() const volatile;
151 test_op_conversion::operator const volatile test_op_conversion_res
**()
157 /* Code for the assignment operator tests. */
159 struct test_op_assign
161 test_op_assign
operator= (const test_op_assign
&);
165 test_op_assign::operator= (const test_op_assign
&)
167 return test_op_assign ();
170 /* Code for the arrow operator tests. */
174 test_op_arrow
operator-> ();
178 test_op_arrow::operator-> ()
180 return test_op_arrow ();
183 /* Code for the logical/arithmetic operators tests. */
189 #define GEN_OP(NS, ...) \
190 namespace test_ops { \
191 void operator __VA_ARGS__ {} \
193 namespace test_op_ ## NS { \
194 void operator __VA_ARGS__ {} \
197 GEN_OP (PLUS_A
, += (E
, E
) )
198 GEN_OP (PLUS
, + (E
, E
) )
199 GEN_OP (MINUS_A
, -= (E
, E
) )
200 GEN_OP (MINUS
, - (E
, E
) )
201 GEN_OP (MOD_A
, %= (E
, E
) )
202 GEN_OP (MOD
, % (E
, E
) )
203 GEN_OP (EQ
, == (E
, E
) )
204 GEN_OP (NEQ
, != (E
, E
) )
205 GEN_OP (LAND
, && (E
, E
) )
206 GEN_OP (LOR
, || (E
, E
) )
207 GEN_OP (SL_A
, <<= (E
, E
) )
208 GEN_OP (SR_A
, >>= (E
, E
) )
209 GEN_OP (SL
, << (E
, E
) )
210 GEN_OP (SR
, >> (E
, E
) )
211 GEN_OP (OE
, |= (E
, E
) )
212 GEN_OP (BIT_O
, | (E
, E
) )
213 GEN_OP (XOR_A
, ^= (E
, E
) )
214 GEN_OP (XOR
, ^ (E
, E
) )
215 GEN_OP (BIT_AND_A
, &= (E
, E
) )
216 GEN_OP (BIT_AND
, & (E
, E
) )
217 GEN_OP (LT
, < (E
, E
) )
218 GEN_OP (LTE
, <= (E
, E
) )
219 GEN_OP (GTE
, >= (E
, E
) )
220 GEN_OP (GT
, > (E
, E
) )
221 GEN_OP (MUL_A
, *= (E
, E
) )
222 GEN_OP (MUL
, * (E
, E
) )
223 GEN_OP (DIV_A
, /= (E
, E
) )
224 GEN_OP (DIV
, / (E
, E
) )
227 GEN_OP (PRE_INC
, ++ (E
) )
228 GEN_OP (POST_INC
, ++ (E
, int) )
229 GEN_OP (PRE_DEC
, -- (E
) )
230 GEN_OP (POST_DEC
, -- (E
, int) )
231 GEN_OP (COMMA
, , (E
, E
) )
242 test_unique_op_call opcall2
;
245 test_op_array op_array
;
250 test_unique_op_array unique_op_array
;