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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And then if the function we're calling is a member function we get another
variation:

struct A {
  int foo();
  int foo() const;
  void bar(int);
};


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

foo.cc: In function ‘int main()’:
foo.cc:11:16: error: no matching function for call to ‘A::bar(<unresolved
overloaded function type>)’
   a.bar( a.foo );
                ^
foo.cc:4:8: note: candidate: void A::bar(int)
   void bar(int);
        ^~~
foo.cc:4:8: note:   no known conversion for argument 1 from ‘<unresolved
overloaded function type>’ to ‘int’


Again, we shouldn't even be trying to find a matching A::bar, because a.foo is
nonsense.

In all three examples we should notice that a.foo is invalid and give an error,
suggesting either a.foo() (to call it) or &A::foo (to form a pointer to the
member function).

Reply via email to