summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-22 20:51:49 +0000
committerTom Tromey <tromey@redhat.com>2013-05-22 20:51:49 +0000
commit72de6e69758282b35491e7289d368eb7542f638f (patch)
tree8c4ef3efa247b6829565cf398211a16adaf3c671 /gdb/testsuite/gdb.cp
parentfc07e754275bc3e4bbe2bd762fdd8fdb57ddc102 (diff)
downloadgdb-72de6e69758282b35491e7289d368eb7542f638f.tar.gz
PR c++/15401:
* c-valprint.c (c_value_print): Use value_addr for references. Convert back to reference type with value_ref. gdb/testsuite * gdb.cp/class2.cc (main): New local 'aref'. * gdb.cp/class2.exp: Check printing of 'aref'.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/class2.cc1
-rw-r--r--gdb/testsuite/gdb.cp/class2.exp4
2 files changed, 5 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/class2.cc b/gdb/testsuite/gdb.cp/class2.cc
index 0c9d9df35d4..97c44de53ff 100644
--- a/gdb/testsuite/gdb.cp/class2.cc
+++ b/gdb/testsuite/gdb.cp/class2.cc
@@ -67,6 +67,7 @@ int main (void)
B beta, *bbp;
C gamma;
empty e;
+ A &aref (alpha);
alpha.a1 = 100;
beta.a1 = 200; beta.b1 = 201; beta.b2 = 202;
diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/class2.exp
index 824f56e8dd9..00b632208e5 100644
--- a/gdb/testsuite/gdb.cp/class2.exp
+++ b/gdb/testsuite/gdb.cp/class2.exp
@@ -110,3 +110,7 @@ gdb_test_no_output "set print object on"
gdb_test "p acp" "= \\(C \\*\\) ${hex}"
gdb_test "p acp->c1" "\\(A \\*\\) 0x0"
gdb_test "p acp->c2" "\\(A \\*\\) ${hex}f"
+
+# Regression test for PR c++/15401.
+# Check that the type printed is a reference.
+gdb_test "p aref" " = \\(A \\&\\) .*"