* typeck.c (check_return_expr): Avoid redundant error.

From-SVN: r277798
This commit is contained in:
Jason Merrill 2019-11-04 17:34:59 -05:00 committed by Jason Merrill
parent 955cd05745
commit 1dee89967b
3 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2019-11-04 Jason Merrill <jason@redhat.com>
* typeck.c (check_return_expr): Avoid redundant error.
2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
* typeck.c (composite_pointer_type): Add a const op_location_t&

View file

@ -9729,7 +9729,7 @@ check_return_expr (tree retval, bool *no_warning)
type. In that case, we have to evaluate the expression for
its side-effects. */
finish_expr_stmt (retval);
else
else if (retval != error_mark_node)
permerror (input_location,
"return-statement with a value, in function "
"returning %qT", valtype);

View file

@ -0,0 +1,7 @@
void f(long);
void f(char);
void g()
{
return f(42); // { dg-error "ambiguous" }
} // { dg-bogus "void" "" { target *-*-* } .-1 }