This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/3713: Pointers to functions or member functions are not compile-time constants
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, philippeb at videotron dot ca
- Subject: Re: c++/3713: Pointers to functions or member functions are not compile-time constants
- From: lerdsuwa at gcc dot gnu dot org
- Date: 10 Aug 2001 15:37:52 -0000
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