diff mbox

[3/4] PR c++/13403 and PR c++/15154: Add new non-trivial return value tests

Message ID CAGyQ6gzWknXgDOY1sxhRfKXgefaETZCUqWTB81GOSGCM_ZmR0g@mail.gmail.com
State New
Headers show

Commit Message

Siva Chandra Reddy Sept. 11, 2014, 6:37 p.m. UTC
gdb/testsuite/ChangeLog:

2014-09-11  Siva Chandra Reddy  <sivachandra@google.com>

        * gdb.cp/non-trivial-retval.cc: Add new test cases.
        * gdb.cp/non-trivial-retval.exp: Add new tests.

Comments

Doug Evans Sept. 29, 2014, 8:05 a.m. UTC | #1
On Thu, Sep 11, 2014 at 11:37 AM, Siva Chandra <sivachandra@google.com> wrote:
> gdb/testsuite/ChangeLog:
>
> 2014-09-11  Siva Chandra Reddy  <sivachandra@google.com>
>
>         * gdb.cp/non-trivial-retval.cc: Add new test cases.
>         * gdb.cp/non-trivial-retval.exp: Add new tests.

LGTM, though make the expected output a bit more specific?
(e.g. replace .*c  = 11.* with .*c  = 11}  ?)
Not a big deal.
diff mbox

Patch

diff --git a/gdb/testsuite/gdb.cp/non-trivial-retval.cc b/gdb/testsuite/gdb.cp/non-trivial-retval.cc
index c7a2d35..19867bc 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 a629339..10e6dbf 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 = 11.*" "p f1 (i1, i2)"
 gdb_test "p f2 (i1, i2)" ".*b = 11.*" "p f2 (i1, i2)"
+gdb_test "p f3 (i1, i2)" ".*c = 11.*" "p f3 (i1, i2)"
+gdb_test "p f4 (i1, i2)" ".*e = 11.*" "p f4 (i1, i2)"