]>
Commit | Line | Data |
---|---|---|
7b282c5a SCR |
1 | /* This testcase is part of GDB, the GNU debugger. |
2 | ||
ecd75fc8 | 3 | Copyright 2012-2014 Free Software Foundation, Inc. |
7b282c5a SCR |
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 3 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, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | class A { | |
a16b0e22 SC |
19 | public: |
20 | int a; | |
7b282c5a SCR |
21 | }; |
22 | ||
a16b0e22 SC |
23 | union U { |
24 | int a; | |
25 | char c; | |
26 | }; | |
27 | ||
28 | class B : public A { | |
29 | public: | |
30 | char a; | |
31 | }; | |
32 | ||
33 | typedef B Btd; | |
7b282c5a SCR |
34 | typedef int *int_ptr; |
35 | ||
36 | int | |
37 | func (const A &a) | |
38 | { | |
39 | int val = 10; | |
40 | int &int_ref = val; | |
41 | int_ptr ptr = &val; | |
42 | int_ptr &int_ptr_ref = ptr; | |
43 | ||
a16b0e22 SC |
44 | B b; |
45 | B b1; | |
46 | ||
47 | b.a = 'a'; | |
48 | b.A::a = 10; | |
49 | ||
50 | B *b_obj = &b1; | |
51 | b_obj->a = 'b'; | |
52 | b_obj->A::a = 100; | |
53 | ||
54 | B &b_ref = b1; | |
55 | Btd &b_td = b1; | |
56 | ||
57 | U u; | |
58 | u.a = 99; | |
59 | ||
7b282c5a SCR |
60 | return 0; /* Break here. */ |
61 | } | |
62 | ||
63 | int | |
64 | main () | |
65 | { | |
66 | A obj; | |
a16b0e22 | 67 | |
7b282c5a SCR |
68 | return func (obj); |
69 | } |