* typeck.c (check_return_expr): Avoid redundant error.
From-SVN: r277798
This commit is contained in:
parent
955cd05745
commit
1dee89967b
3 changed files with 12 additions and 1 deletions
|
@ -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&
|
||||
|
|
|
@ -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);
|
||||
|
|
7
gcc/testsuite/g++.dg/other/return2.C
Normal file
7
gcc/testsuite/g++.dg/other/return2.C
Normal file
|
@ -0,0 +1,7 @@
|
|||
void f(long);
|
||||
void f(char);
|
||||
|
||||
void g()
|
||||
{
|
||||
return f(42); // { dg-error "ambiguous" }
|
||||
} // { dg-bogus "void" "" { target *-*-* } .-1 }
|
Loading…
Add table
Reference in a new issue