]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/59916
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Jan 2014 17:13:01 +0000 (17:13 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Jan 2014 17:13:01 +0000 (17:13 +0000)
* optimize.c (maybe_thunk_body): Build a RETURN_EXPR for
cdtor_returns_this case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207271 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/optimize.c
gcc/testsuite/g++.dg/warn/Wreturn-type-10.C [new file with mode: 0644]

index f2ff37abb8330db2ee22f0dcd66fac2a42ccf2ac..594861b34b94a4914f6947f73125645892cc9c67 100644 (file)
@@ -1,5 +1,9 @@
 2014-01-29  Jason Merrill  <jason@redhat.com>
 
+       PR c++/59916
+       * optimize.c (maybe_thunk_body): Build a RETURN_EXPR for
+       cdtor_returns_this case.
+
        PR c++/59315
        * decl.c (cxx_maybe_build_cleanup): Call mark_used.
 
index 1b3f10a11c5396078c9506bc773c24326284c4d6..b089432a305457a44a995b5ceabf21ba105e3d1a 100644 (file)
@@ -405,8 +405,8 @@ maybe_thunk_body (tree fn, bool force)
              clone_result = DECL_RESULT (clone);
              modify = build2 (MODIFY_EXPR, TREE_TYPE (clone_result),
                               clone_result, call);
+             modify = build1 (RETURN_EXPR, void_type_node, modify);
              add_stmt (modify);
-             BLOCK_VARS (block) = clone_result;
            }
          else
            {
diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C b/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C
new file mode 100644 (file)
index 0000000..2043b6c
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/59916
+// { dg-options "-Os -Wreturn-type" }
+
+class A {};
+
+struct B : virtual public A
+{
+  B();
+  virtual ~B();
+};
+
+B::B() {}
+B::~B() {}