1 // Shows that problem of initializing one object's secondary base from
2 // another object via a user defined copy constructor for that base,
3 // the pointer for the secondary vtable is not set after implicit
4 // copying of the outer class, but rather has the pointer to the main
5 // vtable for the secondary base left over from the user defined copy
6 // constructor for that base.
8 // Correct answer is B::beefy.
9 // g++ prints A::beefy, which is wrong. Cfront gets it right.
13 extern "C" int printf(const char *, ...);
14 extern "C" void exit(int);
24 virtual void print(void) const { }
25 B compute(void) const;
31 C(C& o) { } // with it, things are wrong, without it, they're ok
32 virtual void beefy(void) const { printf("A::beefy\n"); exit(1); }
35 class B : private A, public C {
38 void beefy(void) const { printf("B::beefy\n"); }
41 B A::compute(void) const
50 titi.compute().beefy();