aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2014-09-09 06:46:14 -0700
committerSiva Chandra <sivachandra@chromium.org>2014-10-15 04:27:13 -0700
commit2d1c107c1b8835f4e85c35320d8595a4a6fcaebe (patch)
tree3d49fc98945aeaeb99f55a58e29217def090c600 /gdb/testsuite/gdb.cp
parent82c48ac732edb0155288a93ef3dd39625ff2d2e1 (diff)
downloadgdb-2d1c107c1b8835f4e85c35320d8595a4a6fcaebe.zip
gdb-2d1c107c1b8835f4e85c35320d8595a4a6fcaebe.tar.gz
gdb-2d1c107c1b8835f4e85c35320d8595a4a6fcaebe.tar.bz2
Add new non-trial return value tests.
gdb/testsuite/ChangeLog: * gdb.cp/non-trivial-retval.cc: Add new test cases. * gdb.cp/non-trivial-retval.exp: Add new tests.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/non-trivial-retval.cc46
-rw-r--r--gdb/testsuite/gdb.cp/non-trivial-retval.exp2
2 files changed, 48 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/non-trivial-retval.cc b/gdb/testsuite/gdb.cp/non-trivial-retval.cc
index 4c7810b..8382f40 100644
--- a/gdb/testsuite/gdb.cp/non-trivial-retval.cc
+++ b/gdb/testsuite/gdb.cp/non-trivial-retval.cc
@@ -63,6 +63,52 @@ f2 (int i1, int i2)
return b;
}
+class C
+{
+public:
+ virtual int method ();
+
+ int c;
+};
+
+int
+C::method ()
+{
+ return c;
+}
+
+C
+f3 (int i1, int i2)
+{
+ C c;
+
+ c.c = i1 + i2;
+
+ return c;
+}
+
+class D
+{
+public:
+ int d;
+};
+
+class E : public virtual D
+{
+public:
+ int e;
+};
+
+E
+f4 (int i1, int i2)
+{
+ E e;
+
+ e.e = i1 + i2;
+
+ return e;
+}
+
int
main (void)
{
diff --git a/gdb/testsuite/gdb.cp/non-trivial-retval.exp b/gdb/testsuite/gdb.cp/non-trivial-retval.exp
index 976b99f..7934946 100644
--- a/gdb/testsuite/gdb.cp/non-trivial-retval.exp
+++ b/gdb/testsuite/gdb.cp/non-trivial-retval.exp
@@ -32,3 +32,5 @@ gdb_continue_to_breakpoint "Break here"
gdb_test "p f1 (i1, i2)" ".* = {a = 123}" "p f1 (i1, i2)"
gdb_test "p f2 (i1, i2)" ".* = {b = 123}" "p f2 (i1, i2)"
+gdb_test "p f3 (i1, i2)" ".* = {.* c = 123}" "p f3 (i1, i2)"
+gdb_test "p f4 (i1, i2)" ".* = {.* e = 123}" "p f4 (i1, i2)"