The handling of the ARM ctor-returns-this ABI in the new decloning patch
failed to add a RETURN_EXPR. Fixed thus.
Tested with cross-compiler to arm-eabi, applying to trunk.
commit e1f2153a7facc47b886b24a5b3507bb4bea3e447
Author: Jason Merrill <ja...@redhat.com>
Date: Wed Jan 29 09:16:51 2014 -0500
PR c++/59916
* optimize.c (maybe_thunk_body): Build a RETURN_EXPR for
cdtor_returns_this case.
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 1b3f10a..b089432 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -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
index 0000000..2043b6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C
@@ -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() {}