4.cc 456 B

12345678910111213141516171819202122232425262728293031323334
  1. struct A
  2. {
  3. virtual void foo();
  4. virtual void bar();
  5. };
  6. void A::foo() { } // lose
  7. void A::bar() { } // keep
  8. struct B : public A
  9. {
  10. virtual void foo();
  11. };
  12. void B::foo() { } // lose
  13. void _start() __asm__("_start"); // keep
  14. void start() __asm__("start"); // some toolchains use this name.
  15. A a; // keep
  16. B b;
  17. A *getme() { return &a; } // keep
  18. void _start()
  19. {
  20. getme()->bar();
  21. }
  22. void start ()
  23. {
  24. _start ();
  25. }
  26. extern "C" void __main() { }