This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52453] New: compiling error when get address of a virtual function(invalid use of non-static member function)


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

             Bug #: 52453
           Summary: compiling error when get address of a virtual
                    function(invalid use of non-static member function)
    Classification: Unclassified
           Product: gcc
           Version: 4.2.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wildpointercs@gmail.com


Version:gcc4.2.4,
System :Ubuntu Linux 2.6.24

The preprocessed file:

# 1 "test.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.cpp"

class Test
{
public:
    virtual void func(char *p){}
};

int main()
{
    typedef void (Test::*pTestfunc)(char *);
    pTestfunc pf = &(Test::func); // error here.
}

Error message: invalid use of non-static member function 'virtual void
Test::func(char *)'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]