2000-10-31 Philip Blundell <philb@gnu.org>
[binutils.git] / ld / testsuite / ld-selective / 3.cc
blob79d5e96b7f1a32e9d9df05cf00ca9c1cb202b4dd
1 struct A
3 virtual void foo();
4 virtual void bar();
5 };
7 void A::foo() { } // keep
8 void A::bar() { } // lose
10 struct B : public A
12 virtual void foo();
15 void B::foo() { } // keep
17 void _start() __asm__("_start"); // keep
19 A a; // keep
20 B b;
21 A *getme() { return &a; } // keep
23 void _start()
25 getme()->foo();
26 #ifdef __GNUC__
27 #if (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
28 // gcc-2.95.2 gets this test wrong, and loses B::foo().
29 // Cheat. After all, we aren't trying to test the compiler here.
30 b.foo();
31 #endif
32 #endif
35 // In addition, keep A's virtual table.
37 // We'll wind up keeping `b' and thus B's virtual table because
38 // `a' and `b' are both referenced from the constructor function.
40 extern "C" void __main() { }