aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-02-18 19:10:48 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-02-18 19:10:48 +0000
commiteeaafae2bdf07efbe757579c966da3c422496053 (patch)
tree791125207010daae2e96bcfc9d9de5cfba24201c /gdb/testsuite/gdb.cp
parentae97b9228de63b9496cad36aff26742bea32e2e1 (diff)
downloadgdb-eeaafae2bdf07efbe757579c966da3c422496053.zip
gdb-eeaafae2bdf07efbe757579c966da3c422496053.tar.gz
gdb-eeaafae2bdf07efbe757579c966da3c422496053.tar.bz2
gdb/
* cp-support.c (make_symbol_overload_list_namespace): Do not call make_symbol_overload_list_block with NULL BLOCK. * valarith.c (unop_user_defined_p): Resolve also TYPE_CODE_TYPEDEF. gdb/testsuite/ * gdb.cp/typedef-operator.exp: New file. * gdb.cp/typedef-operator.cc: New file.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/typedef-operator.cc31
-rw-r--r--gdb/testsuite/gdb.cp/typedef-operator.exp33
2 files changed, 64 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/typedef-operator.cc b/gdb/testsuite/gdb.cp/typedef-operator.cc
new file mode 100644
index 0000000..1cfedaa
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/typedef-operator.cc
@@ -0,0 +1,31 @@
+/* This test case is part of GDB, the GNU debugger.
+
+ Copyright 2011 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+class C
+{
+public:
+ int operator* () { return 42; }
+};
+typedef C D;
+
+D u;
+D &v = u;
+
+int main ()
+{
+ return *v;
+}
diff --git a/gdb/testsuite/gdb.cp/typedef-operator.exp b/gdb/testsuite/gdb.cp/typedef-operator.exp
new file mode 100644
index 0000000..64ecef7
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/typedef-operator.exp
@@ -0,0 +1,33 @@
+# Copyright 2011 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the gdb testsuite.
+
+if {[skip_cplus_tests]} { continue }
+
+set testfile "typedef-operator"
+if [prepare_for_testing $testfile $testfile $testfile.cc {c++ debug}] {
+ return -1
+}
+
+gdb_test_no_output "set language c++"
+
+gdb_test "p *u" {You can't do that without a process to debug.} "test crash"
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_test "p *v" " = 42" "test typedef"