re PR c++/49508 (Bogus "control reaches end of non-void function" warning)

PR c++/49508
	* semantics.c (finish_return_stmt): Suppress -Wreturn-type on
	erroneous return statement.

From-SVN: r220252
This commit is contained in:
Jason Merrill 2015-01-29 11:10:08 -05:00 committed by Jason Merrill
parent e1ef8aa939
commit 3dbb84276a
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,9 @@
2015-01-29 Jason Merrill <jason@redhat.com>
PR c++/49508
* semantics.c (finish_return_stmt): Suppress -Wreturn-type on
erroneous return statement.
PR c++/64521
* repo.c (repo_emit_p): It's OK for a clone to be extern at this
point.

View File

@ -888,7 +888,13 @@ finish_return_stmt (tree expr)
if (error_operand_p (expr)
|| (flag_openmp && !check_omp_return ()))
return error_mark_node;
{
/* Suppress -Wreturn-type for this function. */
if (warn_return_type)
TREE_NO_WARNING (current_function_decl) = true;
return error_mark_node;
}
if (!processing_template_decl)
{
if (warn_sequence_point)

View File

@ -72,6 +72,3 @@ int darg (char X::*p)
{
undef3 (1); // { dg-error "" } implicit declaration
} // { dg-warning "no return statement" }
// { dg-message "warning: control reaches end of non-void function" "" { target *-*-* } 36 }
// { dg-message "warning: control reaches end of non-void function" "" { target *-*-* } 65 }