Commit | Line | Data |
---|---|---|
f4e8b6f3 MC |
1 | /* This testcase is part of GDB, the GNU debugger. |
2 | ||
6e19e2bf | 3 | Copyright 2003, 2004 Free Software Foundation, Inc. |
f4e8b6f3 MC |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 2 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
6e19e2bf | 18 | */ |
f4e8b6f3 MC |
19 | |
20 | struct A | |
21 | { | |
22 | virtual ~A (); | |
23 | int a1; | |
24 | }; | |
25 | ||
26 | A::~A() | |
27 | { | |
28 | a1 = 800; | |
29 | } | |
30 | ||
31 | struct B : public A | |
32 | { | |
33 | virtual ~B (); | |
34 | int b1; | |
35 | int b2; | |
36 | }; | |
37 | ||
38 | B::~B() | |
39 | { | |
40 | a1 = 900; | |
41 | b1 = 901; | |
42 | b2 = 902; | |
43 | } | |
44 | ||
45 | // Stop the compiler from optimizing away data. | |
46 | void refer (A *) | |
47 | { | |
48 | ; | |
49 | } | |
50 | ||
98f9cd2d JB |
51 | struct empty {}; |
52 | ||
53 | // Stop the compiler from optimizing away data. | |
54 | void refer (empty *) | |
55 | { | |
56 | ; | |
57 | } | |
58 | ||
f4e8b6f3 MC |
59 | int main (void) |
60 | { | |
61 | A alpha, *aap, *abp; | |
62 | B beta, *bbp; | |
98f9cd2d | 63 | empty e; |
f4e8b6f3 MC |
64 | |
65 | alpha.a1 = 100; | |
66 | beta.a1 = 200; beta.b1 = 201; beta.b2 = 202; | |
67 | ||
68 | aap = α refer (aap); | |
69 | abp = β refer (abp); | |
70 | bbp = β refer (bbp); | |
98f9cd2d | 71 | refer (&e); |
f4e8b6f3 MC |
72 | |
73 | return 0; // marker return 0 | |
74 | } // marker close brace |