This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ problem with virtual inheritance accessibility


  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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]