[rfa/c++testsuite] Add (failing) static member function test to classes.exp

Daniel Jacobowitz
2001-12-05T19:49:20Z

In trying to fix some v3 fails, I found an incredibly bogus line in the
stabs reader; search for the third occurance of is_stub. "ii" can be the
name of a function, or the mangling of its parameters. The fix is trivial,
and will be attached to another one of my v3 patches once the current batch
are approved (I see no good reason to send two separate patches for the same
line).

Here's a testcase. OK?

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer

2001-12-05 Daniel Jacobowitz <drow@mvista.com>

* gdb.c++/classes.exp: Add test for static member function.
* gdb.c++/misc.cc: Add class with static member function.

Index: classes.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/classes.exp,v
retrieving revision 1.8
diff -u -r1.8 classes.exp
--- classes.exp 2001/07/03 19:52:46 1.8
+++ classes.exp 2001/12/05 19:38:51
@@ -308,5 +308,21 @@
}
}

+ # With g++ 2.x and stabs debug info, we misinterpret static methods
+ # whose name matches their argument mangling.
+ send_gdb "ptype class Static\n"
+ gdb_expect {
+ -re "type = (class|struct) Static \{(${ws}public:|)${ws}Static & operator=\\(Static const ?&\\);${ws}Static\\(Static const ?&\\);${ws}Static\\((void|)\\);${ws}static void ii\\(int, int\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class Static"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class Static"
+ }
+ timeout {
+ fail "ptype class Static (timeout)"
+ return
+ }
+ }
+
send_gdb "ptype class vA\n"
gdb_expect {
Index: misc.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/misc.cc,v
retrieving revision 1.4
diff -u -r1.4 misc.cc
--- misc.cc 2000/07/09 05:16:11 1.4
+++ misc.cc 2001/12/05 19:40:04
@@ -269,6 +269,14 @@
inheritance2 ();
}

+// ======================== static member functions =====================
+
+class Static {
+public:
+ static void ii(int, int);
+};
+void Static::ii (int, int) { }
+
// ======================== virtual base classes=========================

class vA {