[comp.lang.c++] Possible cfront 1.2.1 bug

tom@adaptive.uucp (Tom Baker) (10/24/89)

The following code gives a cfront 1.2.1 internal error.  It appears 
that there are problems using pointers to member functions that have
virtual functions.  If the virtual function 'f' is removed from 
'container' then the program compiles.  I tried this with g++ 1.32.0
and it compiled fine.  Is this a legal C++ program?

------------------------< cut here >---------------------------------
// compile with "CC -o bug bug.c"

class container
{
public:
  virtual int f() {return(0);};    // comment this out and it works
  int g() {return(0);}
};

typedef int (container::*mp)();   // pointer to container class fn

main() 
{
  container c;
  mp p = &container::g;
  int a = (c.*p)();               // causes cfront bus error
}
------------------------< cut here >---------------------------------

I get the following error message:

"bug.c", line 17: internal <<cfront 1.2.1 2/16/87>> error: bus error 


According to the documentation that I have, the program should work.


Thomas Baker                    UUCP:  ..ucbvax!ogccse!adaptive!tom
Adaptive Systems, Inc.		INTERNET: tom@asi.com
1400 N.W. Compton Drive, Suite 340      
Beaverton, Oregon 97006