The following code:

struct X
{
    void f() {}

    void g()
    {
        auto h = &f;
    }
};

results in:

error: ISO C++ forbids taking the address of an unqualified
or parenthesized non-static member function to form a pointer
to member function.  Say ‘&X::f’

My question is, why is this not allowed and forbidden by the standard? It would be more convenient as a user to refer to it unqualified, so I assume there is some other rationale (safety? an ambiguity? ease of compiler implementation?) for the requirement?

Edit
Report