derived-main.cpp 254 B

12345678910111213141516171819
  1. // { dg-do run }
  2. #include "lib.h"
  3. struct Derived: public Base
  4. {
  5. virtual ~Derived()
  6. { printf("In Derived destructor\n"); }
  7. };
  8. int main()
  9. {
  10. Derived * d = new Derived;
  11. Destroy(d);
  12. Base * pp = GetPrivate();
  13. delete pp; // Virtual call #2
  14. }