[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 28 16:44:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77777
--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
FWIW the location information is available in the frame above:
Breakpoint 6, invalid_nonstatic_memfn_p (loc=205792, expr=<function_decl
0x7ffff1a16900 f>, complain=3)
at ../../src/gcc/cp/typeck.c:1834
1834 expr);
(gdb) list
1829 if (complain & tf_error)
1830 {
1831 if (DECL_P (expr))
1832 {
1833 error_at (loc, "invalid use of non-static member function
%qD",
1834 expr);
1835 inform (DECL_SOURCE_LOCATION (expr), "declared here");
1836 }
within EXPR_LOCATION (arg):
(gdb) up
#7 0x00000000007b1a65 in resolve_args (args=0x7ffff1a14460 = {...},
complain=3) at ../../src/gcc/cp/call.c:4012
4012 else if (invalid_nonstatic_memfn_p (input_location, arg,
complain))
(gdb) call inform (arg->exp.locus, "")
/tmp/pr77777.cc: In function ‘int main()’:
/tmp/pr77777.cc:11:9: note:
x.f
~~^
so this location could be passed to invalid_nonstatic_memfn_p and a fix-it hint
added.
More information about the Gcc-bugs
mailing list