------- Comment #3 from manu at gcc dot gnu dot org 2010-02-21 19:07 -------
More weirdeness.
// PR c++/17459: Spurious message when forgetting parentheses on call of member
// { dg-do compile }
struct S {
void foo();
void bar() { foo; } // { dg-error "statement cannot resolve address of
overloaded function" }
// { dg-message "note: taking the address of a member function requires the
syntax '&S::foo'" "" { target *-*-* } 5 }
void bar3() { &foo; } // { dg-error "ISO C.. forbids taking the address" }
void * bar2() { return foo; }
};
This testcase produces:
pr17459.C: In member function 'void S::bar()':
pr17459.C:5:19: error: statement cannot resolve address of overloaded function
pr17459.C:5:19: note: taking the address of a member function requires the
syntax '&S::foo'
pr17459.C: In member function 'void S::bar3()':
pr17459.C:7:18: error: ISO C++ forbids taking the address of an unqualified or
parenthesized non-static member function to form a pointer to member function.
Say '&S::f\
oo'
pr17459.C: In member function 'void* S::bar2()':
pr17459.C:8:26: error: argument of type 'void (S::)()' does not match 'void*'
The last one really kills me. It should be the same error as the first one,
isn't it?
Oh, I give up on this one!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17459