c++: Set the locus of the function result decl
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sun, 20 Nov 2022 17:06:04 +0000 (18:06 +0100)
committerJason Merrill <jason@redhat.com>
Fri, 2 Dec 2022 19:17:53 +0000 (14:17 -0500)
commitd19aa6af6634b1e97f38431ad091f3b3f12baf2f
tree613da0d1266dc37b38754f68de5f2dc491eaa40c
parent76dd48f8956b5e17adf0ae1cd1ed3d804a005470
c++: Set the locus of the function result decl

gcc/cp/ChangeLog:

* decl.cc (grokdeclarator): Build RESULT_DECL.
(start_preparsed_function): Copy location from template.
* semantics.cc (apply_deduced_return_type): Handle
arg != current_function_decl.
* method.cc (implicitly_declare_fn): Use it.

gcc/ChangeLog:

* function.cc (init_function_start): Use DECL_RESULT location
for -Waggregate-return warning.

gcc/testsuite/ChangeLog:

* g++.dg/diagnostic/return-type-loc1.C: New test.

Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/cp/decl.cc
gcc/cp/method.cc
gcc/cp/semantics.cc
gcc/function.cc
gcc/testsuite/g++.dg/diagnostic/return-type-loc1.C [new file with mode: 0644]