This bug was discovered simultaneously with #22618, but it seemed different enough to warrant a bug report of its own.
Since foo::f also names a non-static function, the compiler apparently treats the full name as malformed pointer-to-member expression inside the class itself, even though the context is pointer-to-function. struct foo { typedef int (*fun)(int); static int f(int); // overload between static & non-static int f(); static int g(int); // non-overloaded static }; template<foo::fun> struct f_obj { // something .. }; f_obj<&foo::f> a; // OK f_obj<foo::f> b; // OK (note: a and b are of the same type) int foo::f() { f_obj<&foo::f> a; // OK f_obj<foo::f> b; // ERROR: foo::f cannot be a constant expression f_obj<&foo::g> c; // OK f_obj<foo::g> d; // OK } -- Summary: Member function overloading introduces syntax errors Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: squell at alumina dot nl CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22621