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 | |
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')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/userdef.cc | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/userdef.exp | 6 |
3 files changed, 33 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ace5929..73f01bd 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2005-03-08 Nathan Sidwell <nathan@codesourcery.com> + * 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. + * gdb.base/sigbpt.exp: Disable if gdb,nosignals. * gdb.base/signull.exp: Disable if gdb,nosignals. * gdb.cp/bs15503.exp: Disable if skip_cplus_tests 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); diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index 5c9c933..86e901d 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -121,6 +121,8 @@ gdb_test "print one >> 31" "\\\$\[0-9\]* = {x = 0, y = 0}" gdb_test "print !one" "\\\$\[0-9\]* = 0\[\r\n\]" # Assumes 2's complement. So does everything... +gdb_test "print +one" "\\\$\[0-9\]* = {x = 2, y = 3}" + gdb_test "print ~one" "\\\$\[0-9\]* = {x = -3, y = -4}" gdb_test "print -one" "\\\$\[0-9\]* = {x = -2, y = -3}" @@ -138,8 +140,8 @@ gdb_test "print one += 7" "\\\$\[0-9\]* = {x = 9, y = 10}" gdb_test "print two = one" "\\\$\[0-9\]* = {x = 9, y = 10}" # Check that GDB tolerates whitespace in operator names. -gdb_test "break A1::'operator+'" ".*Breakpoint $decimal at.*" -gdb_test "break A1::'operator +'" ".*Breakpoint $decimal at.*" +gdb_test "break A2::'operator+'" ".*Breakpoint $decimal at.*" +gdb_test "break A2::'operator +'" ".*Breakpoint $decimal at.*" gdb_exit return 0 |