This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
The following code compiles and executes fine under RH5.0 gcc, but failes
with egcs-2.90.29 980515 (egcs-1.0.3 release) running under RH5.2. The
error message is:
test.cpp: In method `void Test::bar()':
test.cpp:26: must use .* or ->* to call pointer-to-member function in
`ptr (...)'
Here's the code:
#include <iostream.h>
class Test
{
public:
typedef void (Test::*sPtr)( void );
Test() : fooPtr(&foo) {};
~Test() {};
sPtr fooPtr;
void foo();
void bar();
};
void Test::foo()
{
cout << "foo called" << endl;
}
void Test::bar()
{
sPtr ptr = fooPtr;
ptr();
}
int main()
{
Test test;
test.bar();
}
Is there a way to make this work w/o static functions?
thanks, Mike