$ cat test.cpp 
class Foo { static void f() {} };

int main()
{
        Foo foo;
        void (*f)();
        f = foo.f;
        return 0;
}

$ g++ -Wall test.cpp && echo "success"
success

If trying compile it with another compiler
http://cpp.sourceforge.net/?show=18471
I got something like this:

ComeauTest.c(7): error: function "Foo::f" is inaccessible
          f = foo.f;


-- 
           Summary: static private function
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dushistov at mail dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28588

Reply via email to