PR c++/49508
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 29 Jan 2015 16:10:08 +0000 (16:10 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 29 Jan 2015 16:10:08 +0000 (16:10 +0000)
* semantics.c (finish_return_stmt): Suppress -Wreturn-type on
erroneous return statement.

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

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.old-deja/g++.jason/report.C

index fb3e2dc..2280e6b 100644 (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.
index 75aa501..f325e41 100644 (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)
index b595662..e1079cf 100644 (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 }