re PR c++/59916 (constructors and destructors can cause "control reaches end of non-void function" warnings with -Os)

PR c++/59916
	* optimize.c (maybe_thunk_body): Build a RETURN_EXPR for
	cdtor_returns_this case.

From-SVN: r207271
This commit is contained in:
Jason Merrill 2014-01-29 12:13:01 -05:00 committed by Jason Merrill
parent 4f7c83caa3
commit 8ae90330f0
3 changed files with 18 additions and 1 deletions

View 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.

View 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
{

View File

@ -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() {}