C++ problem with virtual inheritance accessibility

Kenny Simpson theonetruekenny@yahoo.com
Mon Jan 8 10:02:00 GMT 2001


  From what I've read, using virtual private 
inheritance is an idiom that can prevent a class from 
being inherited.  However, the following test case 
successfully compiles on gcc 2.95.2 and on the gcc 
version 2.97 20010103 (experimental) snapshot from the

online compiler submission site.

test.cc:

struct Base {};
struct VPD : virtual private Base {};

// it should be impossible to inherit from VPD, but...

struct Impossible : public VPD
{
  // implicit Impossible::Impossible() : Base(), VPD()
{}
  //   Base() should not be accessible
};

int main()
{
  Imp i1; // should cause implicit
Impossible::Impossible() to be defined
  return 0;
}


Thanks,
-Kenny


__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/


More information about the Gcc-bugs mailing list