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

--- Comment #3 from Paul Haile <paulhaile3 at gmail dot com> ---
Fair enough definitely could be intentional. However, In this example

renaming

typedef void (*b_fptr)(B *);

to

typedef void (*b_fptr)(A *);

gets rid of the error.

It seems restricting the binding such that the object must be the same type as
the class of the member function would solve this. Is there any reason to
allowing the object be any type?

E.g. it seems like this also compiles where the object is a completely
different type

--------
struct A {
void f() { 
}
};

struct C {};
typedef void (*c_fptr)(C *);

int main() {
C c;
c_fptr fp = (c_fptr)(&A::f);
fp(&c);
}
--------

Reply via email to