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]

Re: c++/3713: Pointers to functions or member functions are not compile-time constants


Synopsis: Pointers to functions or member functions are not compile-time constants

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Fri Aug 10 08:37:51 2001
State-Changed-Why:
    Not a bug.  A::p must be defined somewhere outside the class
    A.  The following is the correct version of the code:
    
    #include <iostream>
    using namespace std;
    
    struct A
    {
            void foo()
            {
                    cout << __PRETTY_FUNCTION__ << endl;
            }
    			// This must be defined later
            static void (A::* const p)() = & A::foo;
    };
    void (A::* const A::p)();	// Definition
    
    int main()
    {
            A a;
            (a.*A::p)();
    }

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3713&database=gcc


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