diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-07-25 04:24:50 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-07-25 04:24:50 +0000 |
commit | ab5c9f60b7114072882b15531228a1ec8ce4bafd (patch) | |
tree | 822ef7d2eb63a6a38bed18ae33626bf190eec9ad /gdb/testsuite/gdb.cp | |
parent | 644143c8e18a13bf2da11dbb1d6dd937e6104ff4 (diff) | |
download | gdb-ab5c9f60b7114072882b15531228a1ec8ce4bafd.zip gdb-ab5c9f60b7114072882b15531228a1ec8ce4bafd.tar.gz gdb-ab5c9f60b7114072882b15531228a1ec8ce4bafd.tar.bz2 |
gdb/
* eval.c (evaluate_subexp_for_address): Don't incorrectly discard
calls to C++ operator*.
gdb/testsuite/
* gdb.cp/userdef.cc, gdb.cp/userdef.exp: New tests for unary
operator*.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r-- | gdb/testsuite/gdb.cp/userdef.cc | 23 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/userdef.exp | 9 |
2 files changed, 30 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.cp/userdef.cc b/gdb/testsuite/gdb.cp/userdef.cc index 0ed81dc..4f28172 100644 --- a/gdb/testsuite/gdb.cp/userdef.cc +++ b/gdb/testsuite/gdb.cp/userdef.cc @@ -1,6 +1,6 @@ /* This test script is part of GDB, the GNU debugger. - Copyright 1999, 2002, 2003, 2004, 2005 + Copyright 1999, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -306,12 +306,31 @@ A2 A2::operator+() return A2 (); } +class Member +{ +public: + int z; +}; + +class Container +{ +public: + Member m; + + Member& operator* (); +}; + +Member& Container::operator* () +{ + return this->m; +} int main (void) { A1 one(2,3); A1 two(4,5); A1 three(0,0); + Container c; int val; marker1(); // marker1-returns-here @@ -379,6 +398,8 @@ int main (void) ++three; cout << "preinc " << three; + (*c).z = 1; + return 0; } diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index 834688b..6a8cb04 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -1,5 +1,6 @@ # Tests of overloaded operators resolution. -# Copyright 1998, 1999, 2002, 2004, 2005 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2002, 2004, 2005, 2006 +# Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -143,5 +144,11 @@ gdb_test "print two = one" "\\\$\[0-9\]* = {x = 9, y = 10}" gdb_test "break A2::'operator+'" ".*Breakpoint $decimal at.*" gdb_test "break A2::'operator +'" ".*Breakpoint $decimal at.*" +# Check that GDB handles operator* correctly. +gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}" +gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}" +gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex" +gdb_test "ptype &*c" "type = struct Member {\[\r\n \]+int z;\[\r\n\]+} &\\*" + gdb_exit return 0 |