aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/classes.cc13
-rw-r--r--gdb/testsuite/gdb.cp/classes.exp5
2 files changed, 18 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/classes.cc b/gdb/testsuite/gdb.cp/classes.cc
index 50f0740..a650846 100644
--- a/gdb/testsuite/gdb.cp/classes.cc
+++ b/gdb/testsuite/gdb.cp/classes.cc
@@ -665,6 +665,19 @@ void use_methods ()
base1 b (3);
}
+struct Inner
+{
+ static Inner instance;
+};
+
+struct Outer
+{
+ Inner inner;
+ static Outer instance;
+};
+
+Inner Inner::instance;
+Outer Outer::instance;
int
main()
diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp
index 9e2630a..374b632 100644
--- a/gdb/testsuite/gdb.cp/classes.exp
+++ b/gdb/testsuite/gdb.cp/classes.exp
@@ -602,6 +602,11 @@ proc test_static_members {} {
gdb_test "print cnsi" \
"{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y = 2, static null = <same as static member of an already seen type>, static yy = <same as static member of an already seen type>}}}, static yy = <same as static member of an already seen type>}" \
"print cnsi with static members"
+
+ # Another case of infinite recursion.
+ gdb_test "print Outer::instance" \
+ "{inner = {static instance = {static instance = <same as static member of an already seen type>}}, static instance = {inner = {static instance = {static instance = <same as static member of an already seen type>}}, static instance = <same as static member of an already seen type>}}" \
+ "print recursive static member"
}
proc do_tests {} {