From d19aa6af6634b1e97f38431ad091f3b3f12baf2f Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 20 Nov 2022 18:06:04 +0100 Subject: 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 --- gcc/cp/method.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/cp/method.cc') diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc index 1e962b6..7b4d5a5 100644 --- a/gcc/cp/method.cc +++ b/gcc/cp/method.cc @@ -3079,7 +3079,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, { fn = copy_operator_fn (pattern_fn, EQ_EXPR); DECL_ARTIFICIAL (fn) = 1; - TREE_TYPE (fn) = change_return_type (boolean_type_node, TREE_TYPE (fn)); + apply_deduced_return_type (fn, boolean_type_node); return fn; } -- cgit v1.1