Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | struct A |
2 | { | |
3 | virtual void foo(); | |
4 | virtual void bar(); | |
5 | }; | |
6 | ||
7 | void A::foo() { } // keep | |
62043cea | 8 | void A::bar() { } // lose |
252b5132 RH |
9 | |
10 | struct B : public A | |
11 | { | |
12 | virtual void foo(); | |
13 | }; | |
14 | ||
15 | void B::foo() { } // keep | |
16 | ||
5ad8914f JR |
17 | void _start() __asm__("_start"); // keep |
18 | void start() __asm__("start"); // some toolchains use this name. | |
252b5132 RH |
19 | |
20 | A a; // keep | |
21 | B b; | |
22 | A *getme() { return &a; } // keep | |
23 | ||
24 | void _start() | |
25 | { | |
26 | getme()->foo(); | |
62043cea AM |
27 | #ifdef __GNUC__ |
28 | #if (__GNUC__ == 2 && __GNUC_MINOR__ < 96) | |
29 | // gcc-2.95.2 gets this test wrong, and loses B::foo(). | |
30 | // Cheat. After all, we aren't trying to test the compiler here. | |
31 | b.foo(); | |
32 | #endif | |
33 | #endif | |
252b5132 RH |
34 | } |
35 | ||
5ad8914f JR |
36 | void start () |
37 | { | |
38 | _start (); | |
39 | } | |
40 | ||
252b5132 RH |
41 | // In addition, keep A's virtual table. |
42 | ||
43 | // We'll wind up keeping `b' and thus B's virtual table because | |
44 | // `a' and `b' are both referenced from the constructor function. | |
45 | ||
46 | extern "C" void __main() { } |