diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2005-03-08 14:35:20 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2005-03-08 14:35:20 +0000 |
commit | 36e9969cac95317f057b47509cf63271bccd98b0 (patch) | |
tree | b8c229973ba4500194f9b95686edd5d45fef1e89 /gdb/testsuite/gdb.cp/userdef.cc | |
parent | 3de11b2ef2c380882c4dcf3fa980b9817d229b04 (diff) | |
download | gdb-36e9969cac95317f057b47509cf63271bccd98b0.zip gdb-36e9969cac95317f057b47509cf63271bccd98b0.tar.gz gdb-36e9969cac95317f057b47509cf63271bccd98b0.tar.bz2 |
* ax-gdb.c (gen_expr): Add UNOP_PLUS case.
* c-exp.y (exp): Add unary plus.
* eval.c (evaluate_subexp_standard): Add UNOP_PLUS case.
* valarith.c (value_x_unop): Add UNOP_PLUS case.
(value_pos): New.
* value.h (value_pos): Declare.
* gdb.cp/userdef.cc (A1::operator+): New unary plus.
(A2): New class.
(main): Test operator+.
* gdb.cp/userdef.exp: Test unary plus. Use A2::operator+ for
breakpoint test.
Diffstat (limited to 'gdb/testsuite/gdb.cp/userdef.cc')
-rw-r--r-- | gdb/testsuite/gdb.cp/userdef.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/userdef.cc b/gdb/testsuite/gdb.cp/userdef.cc index a40995a..0cf2595 100644 --- a/gdb/testsuite/gdb.cp/userdef.cc +++ b/gdb/testsuite/gdb.cp/userdef.cc @@ -63,6 +63,7 @@ A1 operator/(const A1&); A1 operator=(const A1&); A1 operator~(); +A1 operator+(); A1 operator-(); int operator!(); A1 operator++(); @@ -225,6 +226,15 @@ A1 A1::operator-(void) return (neg); } +A1 A1::operator+(void) +{ + A1 pos(0,0); + pos.x = +x; + pos.y = +y; + + return (pos); +} + A1 A1::operator~(void) { A1 acompl(0,0); @@ -286,6 +296,17 @@ ostream& operator<<(ostream& outs, A1 one) return (outs << endl << "x = " << one.x << endl << "y = " << one.y << endl << "-------" << endl); } +class A2 { + public: +A2 operator+(); +}; + +A2 A2::operator+() +{ + return A2 (); +} + + int main (void) { A1 one(2,3); @@ -342,6 +363,8 @@ int main (void) val = (!one); cout << "! " << val << endl << "-----"<<endl; + three = (+one); + cout << "+ " << three; three = (-one); cout << "- " << three; three = (~one); |