mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-24 19:01:17 +08:00
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:
parent
4f7c83caa3
commit
8ae90330f0
@ -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.
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
13
gcc/testsuite/g++.dg/warn/Wreturn-type-10.C
Normal file
13
gcc/testsuite/g++.dg/warn/Wreturn-type-10.C
Normal 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() {}
|
Loading…
x
Reference in New Issue
Block a user