Add fix-it hint for missing return statement in assignment operators (PR c++/85523)
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 3 Aug 2018 18:38:13 +0000 (18:38 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Fri, 3 Aug 2018 18:38:13 +0000 (18:38 +0000)
commitbc31a87ac791bc6e733405b1539fbd710c92813e
tree7f272d1d2161125dd562b5c1f25dd467eb8fcf7a
parent2e2bd24b7c8ede398669d61852d962498889942a
Add fix-it hint for missing return statement in assignment operators (PR c++/85523)

gcc/cp/ChangeLog:

PR c++/85523
* decl.c: Include "gcc-rich-location.h".
(add_return_star_this_fixit): New function.
(finish_function): When warning about missing return statements in
functions returning non-void, add a "return *this;" fix-it hint for
assignment operators.

gcc/testsuite/ChangeLog:

PR c++/85523
* g++.dg/pr85523.C: New test.

Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>
From-SVN: r263298
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr85523.C [new file with mode: 0644]