[comp.lang.c++] another C++ problem

hill@nicmad.UUCP (Ray Hill) (12/02/87)

Yet another crazy C++ problem:

The below code is a generalization of a problem we are seeing with C++
compilers and the use of callbacks. Let me know if this works with your C++ 
compiler or what I am doing wrong. I have tested it with all the C++ compilers
available here. Using C++ 1.1, it compiles and runs on a Masscomp 5500, while
using C++ 1.2 on both a Sun and a Pyramid it "bus error"s and "memory faults"
during the C++ compile. (could this be related to 1.2?)

						Thanks
						Ray Hill (hill@nicmad)
------------------------- problem starts here -------------------------
class base
  {
public:
  void method1() {};
  virtual void method2() {};
  };

typedef void (base::*PROC)();
  
main()
  {
  PROC m;
  base *b = new base();

  m = &(base :: method1); (b->*m)(); 
  }