This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77711] New: Add fix-it hints for missing parentheses in member function call


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

            Bug ID: 77711
           Summary: Add fix-it hints for missing parentheses in member
                    function call
           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: ---

struct A {
  int foo() { return 0; }
};

void bar(int);

int main()
{
  A a;
  bar( a.foo );
}

This gives:

foo.cc: In function ‘int main()’:
foo.cc:10:14: error: invalid use of non-static member function ‘int A::foo()’
   bar( a.foo );
              ^
foo.cc:2:7: note: declared here
   int foo() { return 0; }
       ^~~

It should suggest changing it to a.foo()

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]