mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/88554 (Segfault ICE when falling off the end of a reference-returning friend operator)
PR c++/88554 * decl.c (finish_function): For -Wreturn-type don't add a return *this; fixit hint if current_class_ref is NULL. Use a single if instead of two nested ones. * g++.dg/warn/Wreturn-type-11.C: New test. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r267672
This commit is contained in:
parent
44e813ecd1
commit
ff0425cdeb
|
|
@ -1,3 +1,11 @@
|
||||||
|
2019-01-08 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR c++/88554
|
||||||
|
* decl.c (finish_function): For -Wreturn-type don't add a return *this;
|
||||||
|
fixit hint if current_class_ref is NULL. Use a single if instead of
|
||||||
|
two nested ones.
|
||||||
|
|
||||||
2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
|
2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
* decl.c (start_decl): Improve two error_at locations.
|
* decl.c (start_decl): Improve two error_at locations.
|
||||||
|
|
|
||||||
|
|
@ -16097,9 +16097,10 @@ finish_function (bool inline_p)
|
||||||
{
|
{
|
||||||
tree valtype = TREE_TYPE (DECL_RESULT (fndecl));
|
tree valtype = TREE_TYPE (DECL_RESULT (fndecl));
|
||||||
if (TREE_CODE (valtype) == REFERENCE_TYPE
|
if (TREE_CODE (valtype) == REFERENCE_TYPE
|
||||||
|
&& current_class_ref
|
||||||
&& same_type_ignoring_top_level_qualifiers_p
|
&& same_type_ignoring_top_level_qualifiers_p
|
||||||
(TREE_TYPE (valtype), TREE_TYPE (current_class_ref)))
|
(TREE_TYPE (valtype), TREE_TYPE (current_class_ref))
|
||||||
if (global_dc->option_enabled (OPT_Wreturn_type,
|
&& global_dc->option_enabled (OPT_Wreturn_type,
|
||||||
global_dc->option_state))
|
global_dc->option_state))
|
||||||
add_return_star_this_fixit (&richloc, fndecl);
|
add_return_star_this_fixit (&richloc, fndecl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
2019-01-08 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR c++/88554
|
||||||
|
* g++.dg/warn/Wreturn-type-11.C: New test.
|
||||||
|
|
||||||
2019-01-07 David Malcolm <dmalcolm@redhat.com>
|
2019-01-07 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
PR jit/88747
|
PR jit/88747
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
// PR c++/88554
|
||||||
|
// { dg-do compile }
|
||||||
|
// { dg-options "-Wreturn-type" }
|
||||||
|
|
||||||
|
struct X {
|
||||||
|
friend X & operator+= (X &, int) { } // { dg-warning "no return statement in function returning non-void" }
|
||||||
|
// { dg-bogus "return \\*this;" "" { target *-*-* } .-1 }
|
||||||
|
};
|
||||||
|
struct Y {};
|
||||||
|
Y & operator += (Y &, Y &) { } // { dg-warning "no return statement in function returning non-void" }
|
||||||
|
// { dg-bogus "return \\*this;" "" { target *-*-* } .-1 }
|
||||||
Loading…
Reference in New Issue