This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
- From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Sep 2016 16:44:42 +0000
- Subject: [Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
- Auto-submitted: auto-generated
- References: <bug-77777-4@http.gcc.gnu.org/bugzilla/>
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.