Hi! I'm having a hard time to set the correct location of the result decl of member functions in C++. Any hint on where to best fix the missing locus? TIA for any hint (or a fix :). Long version: Neither the C nor the C++ frontend seem to have a working/proper location for the RESULT_DECL of functions. This makes it impossible to have diagnostics point at the return type of a function and hence it is impossible to have fixit-replace hints for the return types. [There is a gfortran bug that asks to use narrower return types for functions in the FE and i meant to get me a C++ warning that would point out all affected spots in the fortran FE..] Adding the correct location to the result decl of a function in the C frontend was easy, see attached. Same for the C++ FE for normal functions. These are covered in the attached sample-testcase return-narrow.cc ¹) and work well. I'm attaching a single patch for the C and C++ FE, knowing that they are to be sent separately upon real submission and probably only once stage1 reopens. But i cannot seem to find a proper spot to handle member functions (if that's the correct term for them). These are preparsed functions AFAICS and i'd need a place where i can get at the declspecs[ds_type_spec] and the function is parsed "enough" that the return type is determined, i think. I'm attaching the sample-testcase return-narrow-2.cc which, with a pristine compiler, gives no location for the result decl at all: ---8<--- $ XXX=1 ../gcc/xg++ -B../gcc -c -o return-narrow.o return-narrow-2.cc -fdiagnostics-color=always return-narrow-2.cc: In member function ‘long unsigned int __mini_vector< >::_M_space_left()’: return-narrow-2.cc:7:3: warning: result decl locus sample 7 | { return _M_finish != 0; } | ^ | the return type return-narrow-2.cc: In instantiation of ‘long unsigned int __mini_vector< >::_M_space_left() [with = std::pair]’: return-narrow-2.cc:9:17: required from here return-narrow-2.cc:6:3: warning: result decl locus sample 6 | _M_space_left() | ^~~~~~~~~~~~~ | the return type return-narrow-2.cc: In instantiation of ‘long unsigned int __mini_vector< >::_M_space_left() [with = int]’: return-narrow-2.cc:10:17: required from here return-narrow-2.cc:6:3: warning: result decl locus sample 6 | _M_space_left() | ^~~~~~~~~~~~~ | the return type ---8<--- I'd like to have the result_decl of _M_space_left point to the type unsigned long on line 5, which i think would be the correct type of that memberfn: 1 namespace std { template < typename, typename > struct pair; } 2 template < typename > struct __mini_vector 3 { 4 int _M_finish; 5 unsigned long 6 _M_space_left() 7 { return _M_finish != 0; } 8 }; 9 template class __mini_vector< std::pair< long, long > >; 10 template class __mini_vector< int >; help? :) TIA! ¹) C functions work out fine once fixed to have the correct loc. C++ functions worked fine once, but i now see that apparently "int my_main" on line 42 regressed again in the meantime: $ XXX=1 ../gcc/xg++ -B../gcc -c -o return-narrow.o return-narrow.cc -fdiagnostics-color=always return-narrow.cc: In function ‘int xyz(int, int, int)’: return-narrow.cc:1:1: warning: result decl locus sample 1 | int xyz (int param1, int param2, int param3) | ^~~ | the return type return-narrow.cc: In function ‘int abc(int, int, int)’: return-narrow.cc:11:1: warning: result decl locus sample 11 | int abc (int param1, int param2, int param3) | ^~~ | the return type return-narrow.cc: In function ‘const void* const* pointer_thingie(void*)’: return-narrow.cc:21:7: warning: result decl locus sample 21 | const void *const * pointer_thingie (void *i) | ^~~~ | the return type return-narrow.cc: In function ‘int comparer(int, int, int)’: return-narrow.cc:25:1: warning: result decl locus sample 25 | int comparer (int param1, int param2, int param3) | ^~~ | the return type return-narrow.cc: In function ‘int main()’: return-narrow.cc:35:1: warning: result decl locus sample 35 | int main (void) // dg-bogus "Function .main. could return .bool." | ^~~ | the return type return-narrow.cc: In function ‘int my_main(int, char**)’: return-narrow.cc:42:25: warning: result decl locus sample 42 | int my_main (int, char**) { return 0; } | ^ | the return type return-narrow.cc: In function ‘int hidden_main(int, char**)’: return-narrow.cc:43:1: warning: result decl locus sample 43 | int hidden_main (int, char**) { return 1; } | ^~~ | the return type return-narrow.cc: In function ‘int i64c(int)’: return-narrow.cc:46:1: warning: result decl locus sample 46 | int i64c(int i) | ^~~ | the return type