[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 Bug 7 depends on bug 43486, which changed state. Bug 43486 Summary: Preserve variable-use locations https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43486 What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 Jonathan Wakely changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #10 from Jonathan Wakely --- Fixed on trunk.
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 --- Comment #9 from Jonathan Wakely --- Author: redi Date: Wed May 30 23:13:48 2018 New Revision: 260979 URL: https://gcc.gnu.org/viewcvs?rev=260979=gcc=rev Log: PR c++/7 improve location for diagnostic Pass in the location of the invalid expression, not the next input location (which might be a comma or closing parenthesis on a different line). gcc/cp: PR c++/7 * call.c (resolve_args): Use location of expression, not current input location. gcc/testsuite: PR c++/7 * g++.dg/diagnostic/pr7.C: New test. Added: trunk/gcc/testsuite/g++.dg/diagnostic/pr7.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/testsuite/ChangeLog
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 Jonathan Wakely changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|dmalcolm at gcc dot gnu.org|redi at gcc dot gnu.org --- Comment #8 from Jonathan Wakely --- I'll give it a go.
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 David Malcolm changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |dmalcolm at gcc dot gnu.org Target Milestone|--- |9.0 --- Comment #7 from David Malcolm --- (In reply to Jonathan Wakely from comment #6) > Hmm, in PR 77711 I claimed to have a fix for this, but I don't know what > happened to that. Jonathan: do you want to implement this and PR 77711 for gcc 9, or should I take it/them?
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 Jonathan Wakely changed: What|Removed |Added Last reconfirmed|2017-08-22 00:00:00 |2018-3-16 --- Comment #6 from Jonathan Wakely --- Hmm, in PR 77711 I claimed to have a fix for this, but I don't know what happened to that. Anyway, here's what Clang says: loc.cc:11:9: error: reference to non-static member function must be called; did you mean to call it with no arguments? x.f ~~^ () 1 error generated.
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 Eric Gallager changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2017-08-22 CC||egallager at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #5 from Eric Gallager --- Confirmed.
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 --- Comment #4 from David Malcolm --- FWIW the location information is available in the frame above: Breakpoint 6, invalid_nonstatic_memfn_p (loc=205792, expr=, complain=3) at ../../src/gcc/cp/typeck.c:1834 1834expr); (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", 1834expr); 1835 inform (DECL_SOURCE_LOCATION (expr), "declared here"); 1836} within EXPR_LOCATION (arg): (gdb) up #7 0x007b1a65 in resolve_args (args=0x71a14460 = {...}, 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/pr7.cc: In function ‘int main()’: /tmp/pr7.cc:11:9: note: x.f ~~^ so this location could be passed to invalid_nonstatic_memfn_p and a fix-it hint added.
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 --- Comment #3 from Jonathan Wakely --- Or maybe even better, make the caret point to the member function, but cover the entire expression: x.foo ~~^~~ (Please ignore the "did you mean...?" part shown in the initial comment, that was produced by a locally patched gcc, but is not relevant to this bug).
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 --- Comment #2 from Jonathan Wakely --- (In reply to David Malcolm from comment #1) > (In reply to Jonathan Wakely from comment #0) > > There are lots of cases where we should use rich locations, but here's one > Do you mean a fix-it hint? I don't think so, but maybe I do :-) What I mean is we should display something like: c.cc:12:4: error: invalid use of non-static member function ‘int X::f()’ x.f ^~~ with a range that covers the relevant expression, not just a range of length zero pointing to the wrong place.
[Bug c++/77777] Use rich location to mark correct expression for "invalid use of non-static member function"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7 David Malcolm changed: What|Removed |Added CC||dmalcolm at gcc dot gnu.org --- Comment #1 from David Malcolm --- (In reply to Jonathan Wakely from comment #0) > There are lots of cases where we should use rich locations, but here's one Do you mean a fix-it hint?