Ensure GDB warnings are styled.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-value-cc.cc
1 /* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2012-2020 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 operator+ (const int a1);
21
22 public:
23 int a;
24 };
25
26 int
27 A::operator+ (const int a1)
28 {
29 return a + a1;
30 }
31
32 union U {
33 int a;
34 char c;
35 };
36
37 class B : public A {
38 public:
39 char a;
40 };
41
42 struct X
43 {
44 union { int x; char y; };
45 union { int a; char b; };
46 };
47
48 union UU
49 {
50 union { int x; char y; };
51 union { int a; char b; };
52 };
53
54 typedef B Btd;
55 typedef int *int_ptr;
56 typedef X Xtd;
57
58 int
59 func (const A &a)
60 {
61 int val = 10;
62 int &int_ref = val;
63 int_ptr ptr = &val;
64 int_ptr &int_ptr_ref = ptr;
65
66 B b;
67 B b1;
68
69 b.a = 'a';
70 b.A::a = 10;
71
72 B *b_obj = &b1;
73 b_obj->a = 'b';
74 b_obj->A::a = 100;
75
76 B &b_ref = b1;
77 Btd &b_td = b1;
78
79 U u;
80 u.a = 99;
81
82 X x;
83 x.x = 101;
84 x.a = 102;
85
86 UU uu;
87 uu.x = 1000;
88
89 X *x_ptr = &x;
90 Xtd *xtd = &x;
91
92 return 0; /* Break here. */
93 }
94
95 int
96 main ()
97 {
98 A obj;
99
100 obj.a = 5;
101
102 return func (obj);
103 }
This page took 0.0381 seconds and 4 git commands to generate.