internal bug by virtual base class composition

Rostislav Chudoba rch@larissa.sd.bi.ruhr-uni-bochum.de
Tue Apr 21 05:15:00 GMT 1998


Here is snapshot of a code producing an internal compiler error

--------------- begin bugx.C

class OIFHeader
{
public:
  virtual void create_instance();
};
 
template< class T >
class OIF
  : public OIFHeader
{
public:
  class inst_tp: public T
  {};
   
  void create_instance(){ 
    inst_tp d;       // internal compiler error is reported here
  }
};

class FirstIfc
{};

class FirstImpl1
  : public virtual FirstIfc
{};
 

OIF<FirstImpl1> d;

-------------------- end bugx.C

The bug is reported when creating an instance of the embedded class inst_tp;
If any of the two `virtual' keywords is removed the code compiles. On
the other hand, if T is inherited as a virtual base class the
compilation gets through too. 

Version info:
Reading specs from /user/rch/egcs/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release) 

(This code compiles with gcc version 2.7.2.1)

rosta



More information about the Gcc-bugs mailing list