https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77777

            Bug ID: 77777
           Summary: Use rich location to mark correct expression for
                    "invalid use of non-static member function"
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

There are lots of cases where we should use rich locations, but here's one to
start with:

struct X {
  int f();
};

void g(int);

int main()
{
  X x;
  g(
      x.f
   );
}

The error is:

c.cc: In function ‘int main()’:
c.cc:12:4: error: invalid use of non-static member function ‘int X::f()’; did
you mean ‘x.X::f()’?
    );
    ^
    ()
c.cc:2:7: note: declared here
   int f();
       ^

The location should point to x.f not the next token.

Reply via email to