[Bug c++/22621] New: Member function overloading introduces syntax errors
squell at alumina dot nl
gcc-bugzilla@gcc.gnu.org
Fri Jul 22 20:38:00 GMT 2005
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
More information about the Gcc-bugs
mailing list