486c3bb
2005-07-26  Jeff Johnston  <jjohnstn@redhat.com>
486c3bb
486c3bb
	* gdb.cp/b146835.exp: New testcase.
486c3bb
	* gdb.cp/b146835.cc: Ditto.
486c3bb
	* gdb.cp/b146835b.cc: Ditto.
486c3bb
	* gdb.cp/b146835.h: Ditto.
486c3bb
Jan Kratochvil 22d1e60
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.cp/b146835b.cc
2280d55
===================================================================
2280d55
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 22d1e60
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.cp/b146835b.cc	2016-02-16 09:49:08.743886620 +0100
486c3bb
@@ -0,0 +1,11 @@
486c3bb
+#include "b146835.h"
486c3bb
+
486c3bb
+C::C() { d = 0; x = 3; }
486c3bb
+
486c3bb
+int C::z (char *s) { return 0; }
486c3bb
+
486c3bb
+C::~C() {}
486c3bb
+
486c3bb
+void A::funcD (class E *e, class D *d) {}
486c3bb
+void A::funcE (E *e, D *d) {}
486c3bb
+void A::funcF (unsigned long x, D *d) {}
Jan Kratochvil 22d1e60
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.cp/b146835.cc
2280d55
===================================================================
2280d55
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 22d1e60
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.cp/b146835.cc	2016-02-16 09:49:08.744886627 +0100
486c3bb
@@ -0,0 +1,32 @@
486c3bb
+#include "b146835.h"
486c3bb
+#include <iostream>
486c3bb
+
486c3bb
+class F : public C {
486c3bb
+
486c3bb
+protected:
486c3bb
+
486c3bb
+   virtual void funcA (unsigned long a, B *b);
486c3bb
+   virtual void funcB (E *e);
486c3bb
+   virtual void funcC (unsigned long x, bool y);
486c3bb
+
486c3bb
+   char *s1, *s2;
486c3bb
+   bool b1;
486c3bb
+   int k;
486c3bb
+
486c3bb
+public:
486c3bb
+   void foo() {
486c3bb
+       std::cout << "foo" << std::endl;
486c3bb
+   }
486c3bb
+};
486c3bb
+
486c3bb
+
486c3bb
+void F::funcA (unsigned long a, B *b) {}
486c3bb
+void F::funcB (E *e) {}
486c3bb
+void F::funcC (unsigned long x, bool y) {}
486c3bb
+
486c3bb
+int  main()
486c3bb
+{
486c3bb
+   F f;
486c3bb
+   f.foo();
486c3bb
+}
486c3bb
+
Jan Kratochvil 22d1e60
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.cp/b146835.exp
2280d55
===================================================================
2280d55
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 22d1e60
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.cp/b146835.exp	2016-02-16 09:51:48.601968339 +0100
dd46ae6
@@ -0,0 +1,47 @@
486c3bb
+# This testcase is part of GDB, the GNU debugger.
486c3bb
+
486c3bb
+# Copyright 2005 Free Software Foundation, Inc.
486c3bb
+
486c3bb
+# This program is free software; you can redistribute it and/or modify
486c3bb
+# it under the terms of the GNU General Public License as published by
486c3bb
+# the Free Software Foundation; either version 2 of the License, or
486c3bb
+# (at your option) any later version.
486c3bb
+#
486c3bb
+# This program is distributed in the hope that it will be useful,
486c3bb
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
486c3bb
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
486c3bb
+# GNU General Public License for more details.
486c3bb
+#
486c3bb
+# You should have received a copy of the GNU General Public License
486c3bb
+# along with this program; if not, write to the Free Software
486c3bb
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
486c3bb
+
486c3bb
+# Check that GDB can properly print an inherited member variable
486c3bb
+# (Bugzilla 146835)
486c3bb
+
486c3bb
+set testfile "b146835"
486c3bb
+set srcfile ${testfile}.cc
486c3bb
+set srcfile2 ${testfile}b.cc
Jan Kratochvil 22d1e60
+set binfile [standard_output_file ${testfile}]
486c3bb
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable {debug c++}] != "" } {
486c3bb
+    return -1
486c3bb
+}
486c3bb
+
486c3bb
+gdb_exit
486c3bb
+gdb_start
486c3bb
+gdb_reinitialize_dir $srcdir/$subdir
486c3bb
+gdb_load ${binfile}
486c3bb
+
486c3bb
+#
486c3bb
+# Run to `main' where we begin our tests.
486c3bb
+#
486c3bb
+
486c3bb
+if ![runto_main] then {
486c3bb
+    gdb_suppress_tests
486c3bb
+}
486c3bb
+
486c3bb
+gdb_test "break 'F::foo()'" ""
486c3bb
+gdb_continue_to_breakpoint "First line foo"
486c3bb
+
486c3bb
+# Verify that we can access the inherited member d
2280d55
+gdb_test "p d" " = \\(D \\*\\) *0x0" "Verify inherited member d accessible"
Jan Kratochvil 22d1e60
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.cp/b146835.h
2280d55
===================================================================
2280d55
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 22d1e60
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.cp/b146835.h	2016-02-16 09:49:08.744886627 +0100
486c3bb
@@ -0,0 +1,36 @@
486c3bb
+
486c3bb
+class A {
486c3bb
+
486c3bb
+protected:
486c3bb
+
486c3bb
+   virtual void funcA (unsigned long a, class B *b) = 0;
486c3bb
+   virtual void funcB (class E *e) = 0;
486c3bb
+   virtual void funcC (unsigned long x, bool y) = 0;
486c3bb
+
486c3bb
+   void funcD (class E *e, class D* d);
486c3bb
+   virtual void funcE (E *e, D *d);
486c3bb
+   virtual void funcF (unsigned long x, D *d);
486c3bb
+};
486c3bb
+
486c3bb
+
486c3bb
+class C : public A {
486c3bb
+
486c3bb
+protected:
486c3bb
+
486c3bb
+   int x;
486c3bb
+   class K *k;
486c3bb
+   class H *h;
486c3bb
+
486c3bb
+   D *d;
486c3bb
+
486c3bb
+   class W *w;
486c3bb
+   class N *n;
486c3bb
+   class L *l;
486c3bb
+   unsigned long *r;
486c3bb
+
486c3bb
+public:
486c3bb
+
486c3bb
+   C();
486c3bb
+   int z (char *s);
486c3bb
+   virtual ~C();
486c3bb
+};