donn@utah-cs.UUCP (Donn Seeley) (04/29/87)
Try feeding the following fragment to C++ 1.2.1:
struct foo;
typedef void (foo::*PMF_foo)();
struct foo {
PMF_foo pmf;
virtual void f() {
(this->*pmf)();
}
};
On our system, the translator finds no syntax errors but eventually
prints 'internal <<cfront 1.2.1 2/16/87>> error: bus error (or
something nasty like that)'.
If you remove the typedef and declare the member 'pmf' without one, as
void (foo::*pmf)();
the translator is happy and the code looks right (I haven't tested it).
Removing the 'virtual' specifier in the definition of f() also makes
the translator feel better.
I noticed another peculiarity while playing with this bug -- it's
impossible to declare a function argument as a pointer to member
functions without using a typedef. The translator simply chokes on
the syntax. The following fails:
struct foo;
void f( void (foo::*)() );
but a variant using a typedef will work:
struct foo;
typedef void (foo::*PMF_foo)();
void f( PMF_foo );
I hope I got the syntax right,
Donn Seeley University of Utah CS Dept donn@cs.utah.edu
40 46' 6"N 111 50' 34"W (801) 581-5668 utah-cs!donn