]> Git Repo - binutils.git/blob - gdb/testsuite/gdb.python/py-value-cc.cc
2013-12-12 Siva Chandra Reddy <[email protected]>
[binutils.git] / gdb / testsuite / gdb.python / py-value-cc.cc
1 /* This testcase is part of GDB, the GNU debugger.
2
3    Copyright 2012-2013 Free Software Foundation, Inc.
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 {
19  public:
20   int a;
21 };
22
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;
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
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
60   return 0; /* Break here.  */
61 }
62
63 int
64 main ()
65 {
66   A obj;
67
68   return func (obj);
69 }
This page took 0.026613 seconds and 4 git commands to generate.