diff options
author | Tom Tromey <tromey@redhat.com> | 2010-03-15 17:26:47 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2010-03-15 17:26:47 +0000 |
commit | 6e31430b7070860436f93153ee1f8d832ca8b7ca (patch) | |
tree | bec489b7843e1af0ec6ae4a5b186774c0a509948 /gdb/testsuite | |
parent | 0f4b045ab1d08ebb204724491ad9797e9ecb5c87 (diff) | |
download | gdb-6e31430b7070860436f93153ee1f8d832ca8b7ca.zip gdb-6e31430b7070860436f93153ee1f8d832ca8b7ca.tar.gz gdb-6e31430b7070860436f93153ee1f8d832ca8b7ca.tar.bz2 |
gdb
* c-exp.y (name_not_typename): Add 'operator' clause.
gdb/testsuite
* gdb.cp/userdef.exp: Add tests for explicit calls to operator==.
* gdb.cp/userdef.cc (operator==): New function.
(main): New locals mem1, mem2.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/userdef.cc | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/userdef.exp | 4 |
3 files changed, 19 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 84c5eef..b675f98 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-03-15 Tom Tromey <tromey@redhat.com> + + * gdb.cp/userdef.exp: Add tests for explicit calls to operator==. + * gdb.cp/userdef.cc (operator==): New function. + (main): New locals mem1, mem2. + 2010-03-15 Jie Zhang <jie@codesourcery.com> * lib/mi-support.exp (mi_gdb_target_load): Delete unused timeout var. diff --git a/gdb/testsuite/gdb.cp/userdef.cc b/gdb/testsuite/gdb.cp/userdef.cc index 338c58a..56a735f 100644 --- a/gdb/testsuite/gdb.cp/userdef.cc +++ b/gdb/testsuite/gdb.cp/userdef.cc @@ -311,6 +311,11 @@ public: int z; }; +bool operator== (const Member &m1, const Member &m2) +{ + return m1.z == m2.z; +} + class Container { public: @@ -330,8 +335,12 @@ int main (void) A1 two(4,5); A1 three(0,0); Container c; + Member mem1, mem2; int val; + mem1.z = 5; + mem2.z = 7; + marker1(); // marker1-returns-here cout << one; // marker1-returns-here cout << two; diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index 5e47d90..33bb485 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -113,6 +113,7 @@ gdb_test "print one > two" "\\\$\[0-9\]* = 0\[\r\n\]" gdb_test "print one >= two" "\\\$\[0-9\]* = 0\[\r\n\]" gdb_test "print one == two" "\\\$\[0-9\]* = 0\[\r\n\]" +gdb_test "print one.operator== (two)" "\\\$\[0-9\]* = 0\[\r\n\]" gdb_test "print one != two" "\\\$\[0-9\]* = 1\[\r\n\]" @@ -155,5 +156,8 @@ gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}" gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex" gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\]+} &\\*" +gdb_test "print operator== (mem1, mem2)" " = false" +gdb_test "print operator== (mem1, mem1)" " = true" + gdb_exit return 0 |